From c5471a5de48c4d1d1950845f5919602bf4ffae11 Mon Sep 17 00:00:00 2001 From: NTG_Lenovo Date: Wed, 13 Aug 2025 15:53:08 +0900 Subject: [PATCH] =?UTF-8?q?all=20in=201=20sprite=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Plugins/AllIn1SpriteShader.meta | 8 + .../AllIn1SpriteShader/!Start_Here.txt | 19 + .../AllIn1SpriteShader/!Start_Here.txt.meta | 14 + .../AllIn1SpriteShaderAssembly.asmdef | 15 + .../AllIn1SpriteShaderAssembly.asmdef.meta | 14 + Assets/Plugins/AllIn1SpriteShader/Demo.meta | 8 + .../AllIn1SpriteShader/Demo/Animation.meta | 8 + .../Demo/Animation/Alpha Cutoff.controller | 72 + .../Animation/Alpha Cutoff.controller.meta | 15 + .../Demo/Animation/AlphaCutoff.anim | 134 + .../Demo/Animation/AlphaCutoff.anim.meta | 15 + .../Demo/Animation/AtlasSpriteBoy.controller | 72 + .../Animation/AtlasSpriteBoy.controller.meta | 15 + .../Demo/Animation/Blur.anim | 134 + .../Demo/Animation/Blur.anim.meta | 15 + .../Demo/Animation/Blur.controller | 72 + .../Demo/Animation/Blur.controller.meta | 15 + .../Demo/Animation/Burn.anim | 233 + .../Demo/Animation/Burn.anim.meta | 15 + .../Demo/Animation/Burn.controller | 72 + .../Demo/Animation/Burn.controller.meta | 15 + .../Demo/Animation/BurningSoldier.anim | 332 + .../Demo/Animation/BurningSoldier.anim.meta | 15 + .../Demo/Animation/BurningSoldier.controller | 72 + .../Animation/BurningSoldier.controller.meta | 15 + .../Demo/Animation/CrazyPattern.anim | 395 + .../Demo/Animation/CrazyPattern.anim.meta | 15 + .../Demo/Animation/CrazyPattern.controller | 72 + .../Animation/CrazyPattern.controller.meta | 15 + .../Demo/Animation/CustomGradient.anim | 134 + .../Demo/Animation/CustomGradient.anim.meta | 15 + .../Demo/Animation/CustomGradient.controller | 72 + .../Animation/CustomGradient.controller.meta | 15 + .../Demo/Animation/Fade.anim | 251 + .../Demo/Animation/Fade.anim.meta | 15 + .../Demo/Animation/Fade.controller | 72 + .../Demo/Animation/Fade.controller.meta | 15 + .../Demo/Animation/Fill Amount 1.controller | 147 + .../Animation/Fill Amount 1.controller.meta | 15 + .../Demo/Animation/Fill Amount.controller | 72 + .../Animation/Fill Amount.controller.meta | 15 + .../Demo/Animation/FillAmount.anim | 134 + .../Demo/Animation/FillAmount.anim.meta | 15 + .../Demo/Animation/Fish Eye.controller | 101 + .../Demo/Animation/Fish Eye.controller.meta | 15 + .../Demo/Animation/Frame.controller | 72 + .../Demo/Animation/Frame.controller.meta | 15 + .../Demo/Animation/Hallucination.anim | 134 + .../Demo/Animation/Hallucination.anim.meta | 15 + .../Demo/Animation/Hit Effect 1.controller | 72 + .../Animation/Hit Effect 1.controller.meta | 15 + .../Demo/Animation/Hit Effect.controller | 72 + .../Demo/Animation/Hit Effect.controller.meta | 15 + .../Demo/Animation/HitEffect.anim | 134 + .../Demo/Animation/HitEffect.anim.meta | 15 + .../Demo/Animation/Hologram.anim | 323 + .../Demo/Animation/Hologram.anim.meta | 15 + .../Demo/Animation/IceSoldier.anim | 278 + .../Demo/Animation/IceSoldier.anim.meta | 15 + .../Demo/Animation/IceSoldier.controller | 72 + .../Demo/Animation/IceSoldier.controller.meta | 15 + .../Demo/Animation/Impact.controller | 72 + .../Demo/Animation/Impact.controller.meta | 15 + .../Demo/Animation/Impact1.anim | 737 + .../Demo/Animation/Impact1.anim.meta | 15 + .../Demo/Animation/MotionBlur.anim | 322 + .../Demo/Animation/MotionBlur.anim.meta | 15 + .../Demo/Animation/Offset.anim | 134 + .../Demo/Animation/Offset.anim.meta | 15 + .../Demo/Animation/Offset.controller | 72 + .../Demo/Animation/Offset.controller.meta | 15 + .../Demo/Animation/Original.controller | 72 + .../Demo/Animation/Original.controller.meta | 15 + .../Demo/Animation/Posterize.anim | 134 + .../Demo/Animation/Posterize.anim.meta | 15 + .../Demo/Animation/Posterize.controller | 72 + .../Demo/Animation/Posterize.controller.meta | 15 + .../Demo/Animation/RadialFillAmount.anim | 134 + .../Demo/Animation/RadialFillAmount.anim.meta | 15 + .../Animation/RadialFillAmount.controller | 72 + .../RadialFillAmount.controller.meta | 15 + .../Demo/Animation/Rotate.anim | 116 + .../Demo/Animation/Rotate.anim.meta | 15 + .../Demo/Animation/Rotate.controller | 72 + .../Demo/Animation/Rotate.controller.meta | 15 + .../Demo/Animation/ScreenHit.anim | 134 + .../Demo/Animation/ScreenHit.anim.meta | 15 + .../Demo/Animation/ScreenHit.controller | 72 + .../Demo/Animation/ScreenHit.controller.meta | 15 + .../Demo/Animation/Shield Soldier.controller | 72 + .../Animation/Shield Soldier.controller.meta | 15 + .../Demo/Animation/ShieldSparksPS.anim | 601 + .../Demo/Animation/ShieldSparksPS.anim.meta | 15 + .../Demo/Animation/Shine.anim | 152 + .../Demo/Animation/Shine.anim.meta | 15 + .../Demo/Animation/Shine.controller | 72 + .../Demo/Animation/Shine.controller.meta | 15 + .../Demo/Animation/ShinyBoy.anim | 179 + .../Demo/Animation/ShinyBoy.anim.meta | 15 + .../Demo/Animation/Soldier.controller | 72 + .../Demo/Animation/Soldier.controller.meta | 15 + .../Demo/Animation/SoldierRun.anim | 458 + .../Demo/Animation/SoldierRun.anim.meta | 15 + .../Demo/Animation/Sprite.controller | 72 + .../Demo/Animation/Sprite.controller.meta | 15 + .../Demo/Animation/Teleport.anim | 215 + .../Demo/Animation/Teleport.anim.meta | 15 + .../Demo/Animation/Twist 1.controller | 147 + .../Demo/Animation/Twist 1.controller.meta | 15 + .../Demo/Animation/Twist.anim | 134 + .../Demo/Animation/Twist.anim.meta | 15 + .../Demo/Animation/Twist.controller | 72 + .../Demo/Animation/Twist.controller.meta | 15 + .../Demo/Animation/TwistDisappear.anim | 647 + .../Demo/Animation/TwistDisappear.anim.meta | 15 + .../Demo/Animation/Zoom.anim | 134 + .../Demo/Animation/Zoom.anim.meta | 15 + .../Demo/Animation/Zoom.controller | 72 + .../Demo/Animation/Zoom.controller.meta | 15 + .../Demo/Animation/hpBar.anim | 134 + .../Demo/Animation/hpBar.anim.meta | 15 + .../AllIn1SpriteShader/Demo/Demo.unity | 56947 ++++++++++++++++ .../AllIn1SpriteShader/Demo/Demo.unity.meta | 14 + .../AllIn1SpriteShader/Demo/Demo2.unity | 9421 +++ .../AllIn1SpriteShader/Demo/Demo2.unity.meta | 14 + .../Demo/DemoLitShader.unity | 1234 + .../Demo/DemoLitShader.unity.meta | 14 + .../AllIn1SpriteShader/Demo/Fonts.meta | 8 + .../Demo/Fonts/CaviarDreams.ttf | Bin 0 -> 59284 bytes .../Demo/Fonts/CaviarDreams.ttf.meta | 29 + .../Demo/Fonts/CaviarDreams_Bold.ttf | Bin 0 -> 56392 bytes .../Demo/Fonts/CaviarDreams_Bold.ttf.meta | 30 + .../Demo/Fonts/PoetsenOne-Regular.ttf | Bin 0 -> 172456 bytes .../Demo/Fonts/PoetsenOne-Regular.ttf.meta | 29 + .../AllIn1SpriteShader/Demo/Materials.meta | 8 + .../Demo/Materials/Color Ramp Gradient.mat | 274 + .../Materials/Color Ramp Gradient.mat.meta | 15 + .../Demo/Materials/DemoGradient.mat | 275 + .../Demo/Materials/DemoGradient.mat.meta | 15 + .../Demo/Materials/Fire.mat | 188 + .../Demo/Materials/Fire.mat.meta | 15 + .../Demo/Materials/FireSoldier.mat | 189 + .../Demo/Materials/FireSoldier.mat.meta | 15 + .../AllIn1SpriteShader/Demo/Materials/Ice.mat | 188 + .../Demo/Materials/Ice.mat.meta | 15 + .../Demo/Materials/IceSoldier.mat | 209 + .../Demo/Materials/IceSoldier.mat.meta | 15 + .../Demo/Materials/LitFloor.mat | 292 + .../Demo/Materials/LitFloor.mat.meta | 15 + .../Demo/Materials/LitSprite1.mat | 245 + .../Demo/Materials/LitSprite1.mat.meta | 15 + .../Demo/Materials/LitSprite2.mat | 244 + .../Demo/Materials/LitSprite2.mat.meta | 15 + .../Demo/Materials/LitSprite3.mat | 245 + .../Demo/Materials/LitSprite3.mat.meta | 15 + .../Demo/Materials/LitSpriteTransparent.mat | 245 + .../Materials/LitSpriteTransparent.mat.meta | 15 + .../Demo/Materials/LitWall.mat | 292 + .../Demo/Materials/LitWall.mat.meta | 15 + .../Demo/Materials/MagicRing.mat | 238 + .../Demo/Materials/MagicRing.mat.meta | 15 + .../Demo/Materials/Outline1.mat | 188 + .../Demo/Materials/Outline1.mat.meta | 15 + .../Demo/Materials/Shield.mat | 189 + .../Demo/Materials/Shield.mat.meta | 15 + .../Demo/Materials/ShieldSoldier.mat | 209 + .../Demo/Materials/ShieldSoldier.mat.meta | 15 + .../Demo/Materials/SnowFlake.mat | 85 + .../Demo/Materials/SnowFlake.mat.meta | 15 + .../Demo/Materials/Sparks.mat | 85 + .../Demo/Materials/Sparks.mat.meta | 15 + .../Demo/PostProcessProfiles.meta | 8 + .../AllIn1PostProcessing.asset | 3 + .../AllIn1PostProcessing.asset.meta | 15 + .../AllIn1SpriteShader/Demo/Prefabs.meta | 8 + .../Demo/Prefabs/Particle System Demo.prefab | 5005 ++ .../Prefabs/Particle System Demo.prefab.meta | 14 + .../Demo/Prefabs/Shield Soldier Demo.prefab | 5267 ++ .../Prefabs/Shield Soldier Demo.prefab.meta | 14 + .../AllIn1SpriteShader/Demo/Scripts.meta | 8 + .../Demo/Scripts/All1ShaderDemoController.cs | 86 + .../Scripts/All1ShaderDemoController.cs.meta | 18 + .../Demo/Scripts/All1TextureOffsetOverTIme.cs | 57 + .../Scripts/All1TextureOffsetOverTIme.cs.meta | 18 + .../Demo/Scripts/AllIn1AutoRotate.cs | 16 + .../Demo/Scripts/AllIn1AutoRotate.cs.meta | 18 + .../Demo/Scripts/AllIn1ScrollProperty.cs | 62 + .../Demo/Scripts/AllIn1ScrollProperty.cs.meta | 18 + .../Demo/Scripts/Demo2AutoScroll.cs | 49 + .../Demo/Scripts/Demo2AutoScroll.cs.meta | 18 + .../Demo/Scripts/DemoCamera.cs | 36 + .../Demo/Scripts/DemoCamera.cs.meta | 18 + .../Demo/Scripts/DemoCircleExpositor.cs | 54 + .../Demo/Scripts/DemoCircleExpositor.cs.meta | 18 + .../Demo/Scripts/DemoItem.cs | 14 + .../Demo/Scripts/DemoItem.cs.meta | 18 + .../Demo/Scripts/DemoRandomColorSwap.cs | 39 + .../Demo/Scripts/DemoRandomColorSwap.cs.meta | 18 + .../Demo/Scripts/DemoRepositionExpositor.cs | 24 + .../Scripts/DemoRepositionExpositor.cs.meta | 18 + .../AllIn1SpriteShader/Demo/Textures.meta | 8 + .../Demo/Textures/BoyGirl.png | 3 + .../Demo/Textures/BoyGirl.png.meta | 204 + .../Demo/Textures/Circle.png | 3 + .../Demo/Textures/Circle.png.meta | 353 + .../Demo/Textures/IceTexture.png | 3 + .../Demo/Textures/IceTexture.png.meta | 97 + .../Demo/Textures/Magic1.png | 3 + .../Demo/Textures/Magic1.png.meta | 95 + .../Demo/Textures/Magic2.png | 3 + .../Demo/Textures/Magic2.png.meta | 128 + .../Demo/Textures/RockTexture.png | 3 + .../Demo/Textures/RockTexture.png.meta | 130 + .../Demo/Textures/RockTextureNormal.png | 3 + .../Demo/Textures/RockTextureNormal.png.meta | 130 + .../Demo/Textures/Square.png | 3 + .../Demo/Textures/Square.png.meta | 105 + .../Demo/Textures/WoodTexture.png | 3 + .../Demo/Textures/WoodTexture.png.meta | 130 + .../Demo/Textures/WoodTextureNormal.png | 3 + .../Demo/Textures/WoodTextureNormal.png.meta | 130 + .../Demo/Textures/backMountain.png | 3 + .../Demo/Textures/backMountain.png.meta | 141 + .../Demo/Textures/coals.png | 3 + .../Demo/Textures/coals.png.meta | 130 + .../Demo/Textures/coalsEmissive.png | 3 + .../Demo/Textures/coalsEmissive.png.meta | 130 + .../AllIn1SpriteShader/Demo/Textures/flag.png | 3 + .../Demo/Textures/flag.png.meta | 204 + .../Demo/Textures/flameShape.png | 3 + .../Demo/Textures/flameShape.png.meta | 130 + .../Demo/Textures/grass.png | 3 + .../Demo/Textures/grass.png.meta | 141 + .../Demo/Textures/shield.png | 3 + .../Demo/Textures/shield.png.meta | 130 + .../Demo/Textures/shieldGlow.png | 3 + .../Demo/Textures/shieldGlow.png.meta | 130 + .../Demo/Textures/snowFlake.png | 3 + .../Demo/Textures/snowFlake.png.meta | 97 + .../Demo/Textures/spaceSoldier.png | 3 + .../Demo/Textures/spaceSoldier.png.meta | 176 + .../Demo/Textures/spaceSoldierColorSwap.png | 3 + .../Textures/spaceSoldierColorSwap.png.meta | 141 + .../Demo/Textures/spaceSoldierGlow.png | 3 + .../Demo/Textures/spaceSoldierGlow.png.meta | 141 + .../Textures/spaceSoldierHelmetTopMask.png | 3 + .../spaceSoldierHelmetTopMask.png.meta | 97 + .../Demo/Textures/spaceSoldierNormal.png | 3 + .../Demo/Textures/spaceSoldierNormal.png.meta | 119 + .../Demo/Textures/spark.png | 3 + .../Demo/Textures/spark.png.meta | 97 + .../Demo/Textures/splotch.png | 3 + .../Demo/Textures/splotch.png.meta | 97 + .../Demo/Textures/sunDoodle.png | 3 + .../Demo/Textures/sunDoodle.png.meta | 130 + .../Demo/Textures/water.png | 3 + .../Demo/Textures/water.png.meta | 141 + .../AllIn1SpriteShader/Documentation.pdf | Bin 0 -> 357759 bytes .../AllIn1SpriteShader/Documentation.pdf.meta | 14 + .../Plugins/AllIn1SpriteShader/Materials.meta | 8 + .../Materials/EmptyMaterial.mat | 178 + .../Materials/EmptyMaterial.mat.meta | 15 + .../Materials/ScaledTIme.mat | 210 + .../Materials/ScaledTIme.mat.meta | 15 + .../Materials/UIStencil.mat | 177 + .../Materials/UIStencil.mat.meta | 15 + .../Plugins/AllIn1SpriteShader/Scripts.meta | 8 + .../Scripts/All1CreateUnifiedOutline.cs | 96 + .../Scripts/All1CreateUnifiedOutline.cs.meta | 18 + .../Scripts/AllIn1Shader.cs | 815 + .../Scripts/AllIn1Shader.cs.meta | 18 + .../Scripts/AllIn1ShaderWindow.cs | 692 + .../Scripts/AllIn1ShaderWindow.cs.meta | 18 + .../AllIn1SpriteShader/Scripts/Editor.meta | 9 + .../Editor/AllIn1ShaderGradientDrawer.cs | 282 + .../Editor/AllIn1ShaderGradientDrawer.cs.meta | 18 + .../Scripts/Editor/AllIn1ShaderImporter.cs | 227 + .../Editor/AllIn1ShaderImporter.cs.meta | 18 + .../Editor/AllIn1ShaderScriptEditor.cs | 324 + .../Editor/AllIn1ShaderScriptEditor.cs.meta | 18 + .../AllIn1SpriteShaderLitMaterialInspector.cs | 829 + ...n1SpriteShaderLitMaterialInspector.cs.meta | 18 + .../AllIn1SpriteShaderMaterialInspector.cs | 828 + ...llIn1SpriteShaderMaterialInspector.cs.meta | 18 + ...lIn1SpriteShaderUiMaskMaterialInspector.cs | 758 + ...priteShaderUiMaskMaterialInspector.cs.meta | 18 + .../Scripts/Editor/RenderPipelineChecker.cs | 74 + .../Editor/RenderPipelineChecker.cs.meta | 18 + .../AllIn1SpriteShader/Scripts/RandomSeed.cs | 37 + .../Scripts/RandomSeed.cs.meta | 18 + .../AllIn1SpriteShader/Scripts/SetAtlasUvs.cs | 179 + .../Scripts/SetAtlasUvs.cs.meta | 18 + .../Scripts/SetGlobalTimeNew.cs | 26 + .../Scripts/SetGlobalTimeNew.cs.meta | 18 + .../Scripts/SetGlobalTimeUnity2018.cs | 26 + .../Scripts/SetGlobalTimeUnity2018.cs.meta | 18 + .../AllIn1SpriteShader/Scripts/Texture.meta | 8 + .../Texture/AllIn1SpriteShaderEditorImage.png | 3 + .../AllIn1SpriteShaderEditorImage.png.meta | 99 + .../Scripts/TrueShadowCompatibility.cs | 39 + .../Scripts/TrueShadowCompatibility.cs.meta | 18 + .../Plugins/AllIn1SpriteShader/Shaders.meta | 8 + .../Shaders/AllIn1OneShaderFunctions.cginc | 71 + .../AllIn1OneShaderFunctions.cginc.meta | 16 + .../Shaders/AllIn1SpriteShader.shader | 1234 + .../Shaders/AllIn1SpriteShader.shader.meta | 29 + .../Shaders/AllIn1SpriteShaderLit.shader | 17700 +++++ .../Shaders/AllIn1SpriteShaderLit.shader.meta | 16 + .../AllIn1SpriteShaderLitTransparent.shader | 17705 +++++ ...lIn1SpriteShaderLitTransparent.shader.meta | 16 + .../AllIn1SpriteShaderScaledTime.shader | 1236 + .../AllIn1SpriteShaderScaledTime.shader.meta | 29 + .../Shaders/AllIn1SpriteShaderUiMask.shader | 1247 + .../AllIn1SpriteShaderUiMask.shader.meta | 29 + .../AllIn1SpriteShaderUiMaskScaledTime.shader | 1249 + ...n1SpriteShaderUiMaskScaledTime.shader.meta | 29 + .../Shaders/LitShaders.meta | 8 + ...aderLitTransparent_BetterShader.surfshader | 1437 + ...itTransparent_BetterShader.surfshader.meta | 17 + ...erLitTransparent_BetterShader_HDRP2019.txt | 16853 +++++ ...Transparent_BetterShader_HDRP2019.txt.meta | 14 + ...erLitTransparent_BetterShader_HDRP2020.txt | 25674 +++++++ ...Transparent_BetterShader_HDRP2020.txt.meta | 14 + ...erLitTransparent_BetterShader_HDRP2021.txt | 25529 +++++++ ...Transparent_BetterShader_HDRP2021.txt.meta | 14 + ...erLitTransparent_BetterShader_HDRP2022.txt | 26358 +++++++ ...Transparent_BetterShader_HDRP2022.txt.meta | 14 + ...erLitTransparent_BetterShader_HDRP2023.txt | 26409 +++++++ ...Transparent_BetterShader_HDRP2023.txt.meta | 14 + ...erLitTransparent_BetterShader_Standard.txt | 17703 +++++ ...Transparent_BetterShader_Standard.txt.meta | 14 + ...derLitTransparent_BetterShader_URP2019.txt | 11791 ++++ ...tTransparent_BetterShader_URP2019.txt.meta | 14 + ...derLitTransparent_BetterShader_URP2020.txt | 11893 ++++ ...tTransparent_BetterShader_URP2020.txt.meta | 14 + ...derLitTransparent_BetterShader_URP2021.txt | 14456 ++++ ...tTransparent_BetterShader_URP2021.txt.meta | 14 + ...derLitTransparent_BetterShader_URP2022.txt | 14505 ++++ ...tTransparent_BetterShader_URP2022.txt.meta | 14 + ...derLitTransparent_BetterShader_URP2023.txt | 17685 +++++ ...tTransparent_BetterShader_URP2023.txt.meta | 14 + ...In1SpriteShaderLit_BetterShader.surfshader | 1435 + ...riteShaderLit_BetterShader.surfshader.meta | 17 + ...1SpriteShaderLit_BetterShader_HDRP2019.txt | 16847 +++++ ...teShaderLit_BetterShader_HDRP2019.txt.meta | 14 + ...1SpriteShaderLit_BetterShader_HDRP2020.txt | 25666 +++++++ ...teShaderLit_BetterShader_HDRP2020.txt.meta | 14 + ...1SpriteShaderLit_BetterShader_HDRP2021.txt | 25521 +++++++ ...teShaderLit_BetterShader_HDRP2021.txt.meta | 14 + ...1SpriteShaderLit_BetterShader_HDRP2022.txt | 26350 +++++++ ...teShaderLit_BetterShader_HDRP2022.txt.meta | 14 + ...1SpriteShaderLit_BetterShader_HDRP2023.txt | 26401 +++++++ ...teShaderLit_BetterShader_HDRP2023.txt.meta | 14 + ...1SpriteShaderLit_BetterShader_Standard.txt | 17698 +++++ ...teShaderLit_BetterShader_Standard.txt.meta | 14 + ...n1SpriteShaderLit_BetterShader_URP2019.txt | 11786 ++++ ...iteShaderLit_BetterShader_URP2019.txt.meta | 14 + ...n1SpriteShaderLit_BetterShader_URP2020.txt | 11888 ++++ ...iteShaderLit_BetterShader_URP2020.txt.meta | 14 + ...n1SpriteShaderLit_BetterShader_URP2021.txt | 14450 ++++ ...iteShaderLit_BetterShader_URP2021.txt.meta | 14 + ...n1SpriteShaderLit_BetterShader_URP2022.txt | 14499 ++++ ...iteShaderLit_BetterShader_URP2022.txt.meta | 14 + ...n1SpriteShaderLit_BetterShader_URP2023.txt | 17678 +++++ ...iteShaderLit_BetterShader_URP2023.txt.meta | 14 + .../Shaders/LitShaders/_README.txt | 31 + .../Shaders/LitShaders/_README.txt.meta | 14 + .../Plugins/AllIn1SpriteShader/Textures.meta | 8 + .../Textures/GradientTextures.meta | 8 + .../GradientTextures/gradientTexture_1.png | 3 + .../gradientTexture_1.png.meta | 95 + .../GradientTextures/gradientTexture_2.png | 3 + .../gradientTexture_2.png.meta | 95 + .../GradientTextures/palette-bumbleberry.psd | 3 + .../palette-bumbleberry.psd.meta | 139 + .../GradientTextures/palette-cool.psd | 3 + .../GradientTextures/palette-cool.psd.meta | 139 + .../GradientTextures/palette-downwell.png | 3 + .../palette-downwell.png.meta | 139 + .../GradientTextures/palette-earthy.psd | 3 + .../GradientTextures/palette-earthy.psd.meta | 139 + .../palette-gameboy-pop-1x.png | 3 + .../palette-gameboy-pop-1x.png.meta | 139 + .../GradientTextures/palette-gameboy.psd | 3 + .../GradientTextures/palette-gameboy.psd.meta | 139 + .../palette-metroid-ii-sgb-1x.png | 3 + .../palette-metroid-ii-sgb-1x.png.meta | 139 + .../GradientTextures/palette-mist-gb-1x.png | 3 + .../palette-mist-gb-1x.png.meta | 139 + .../GradientTextures/palette-neapolitan.psd | 3 + .../palette-neapolitan.psd.meta | 139 + .../palette-nintendo-gameboy-bgb-1x.png | 3 + .../palette-nintendo-gameboy-bgb-1x.png.meta | 139 + ...palette-nintendo-gameboy-black-zero-1x.png | 3 + ...te-nintendo-gameboy-black-zero-1x.png.meta | 139 + .../GradientTextures/palette-platinum-1x.png | 3 + .../palette-platinum-1x.png.meta | 139 + .../Textures/GradientTextures/shadeRamp.png | 3 + .../GradientTextures/shadeRamp.png.meta | 95 + .../GradientTextures/toonShadeRamp.png | 3 + .../GradientTextures/toonShadeRamp.png.meta | 95 + .../Textures/NormalMaps.meta | 8 + .../NormalMaps/spaceSoldierNormalMap.png | 3 + .../NormalMaps/spaceSoldierNormalMap.png.meta | 95 + .../AllIn1SpriteShader/Textures/UVChecker.png | 3 + .../Textures/UVChecker.png.meta | 139 + .../AllIn1SpriteShader/Textures/black.png | 3 + .../Textures/black.png.meta | 95 + .../AllIn1SpriteShader/Textures/fire.png | 3 + .../AllIn1SpriteShader/Textures/fire.png.meta | 139 + .../AllIn1SpriteShader/Textures/fire2.png | 3 + .../Textures/fire2.png.meta | 139 + .../Textures/flameNoise.png | 3 + .../Textures/flameNoise.png.meta | 139 + .../Textures/flameNoise2.png | 3 + .../Textures/flameNoise2.png.meta | 139 + .../AllIn1SpriteShader/Textures/gradient.png | 3 + .../Textures/gradient.png.meta | 139 + .../AllIn1SpriteShader/Textures/gradient2.png | 3 + .../Textures/gradient2.png.meta | 117 + .../AllIn1SpriteShader/Textures/rainbow.png | 3 + .../Textures/rainbow.png.meta | 139 + .../Textures/seamlessNoise.png | 3 + .../Textures/seamlessNoise.png.meta | 139 + .../Textures/toonSeamlessNoise.png | 3 + .../Textures/toonSeamlessNoise.png.meta | 139 + .../AllIn1SpriteShader/Textures/white.png | 3 + .../Textures/white.png.meta | 95 + Assets/_DDD/Common/Materials/ItemSlotUi.mat | 2 +- 429 files changed, 568607 insertions(+), 1 deletion(-) create mode 100644 Assets/Plugins/AllIn1SpriteShader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef create mode 100644 Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Fonts.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Documentation.pdf create mode 100644 Assets/Plugins/AllIn1SpriteShader/Documentation.pdf.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Materials.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat create mode 100644 Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Texture.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs create mode 100644 Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt create mode 100644 Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/black.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/black.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/fire.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/fire.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png.meta create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/white.png create mode 100644 Assets/Plugins/AllIn1SpriteShader/Textures/white.png.meta diff --git a/Assets/Plugins/AllIn1SpriteShader.meta b/Assets/Plugins/AllIn1SpriteShader.meta new file mode 100644 index 000000000..6c140a296 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 151483ddcae0bba4da530432cab5e818 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt b/Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt new file mode 100644 index 000000000..4e3b03fa7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt @@ -0,0 +1,19 @@ +Hi there! Thanks for purchasing the asset, I really hope you enjoy it and that it helps you take your projects to the next level :D + +If this is your first time using the asset reading the First Steps section of the Documentation PDF or watching this quick overview video is the best place to start: +https://youtu.be/ThvqkJ5q-gk +You will learn the basic workflow in a matter of minutes. And then, to learn all the asset can do you can proceed to read the rest of the Documentation or to watch all the other video tutorials. + +The asset is mainly targeted to be used in sprites and UI. But it can be used anywhere. Many creative users also use the asset in Meshes and VFX materials. +That being said I just made a new specialized asset for VFX. It's a spiritual successor to this asset but made with VFX creation in mind. +It has an awesome shader, more than 50 ready to use example prefabs, a huge asset library, editor tools and more. +Get it here with a HUGE DISCOUNT for owning this asset: https://assetstore.unity.com/packages/vfx/all-in-1-vfx-toolkit-206665 + + +I’m always open for questions, feedback and suggestions. The best way to contact me is by email. Please don’t write questions in the Unity Forums, Youtube videos, Twitter or wherever else since I will probably miss them. +I always reply much faster (in 24h or less) by email. +When reaching out please attach your invoice number too and make sure you have read the Documentation PDF or watched the equivalent video playlist linked in the PDF. +The email address is: seasidegamestudios@gmail.com + +If you like the asset please make sure to drop a review on the Asset Store page. It helps out a ton: +https://assetstore.unity.com/packages/vfx/shaders/all-in-1-sprite-shader-156513 \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt.meta b/Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt.meta new file mode 100644 index 000000000..106434f16 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 40da9e3a3b0e50c4599a7abc58b8598e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/!Start_Here.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef b/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef new file mode 100644 index 000000000..b6ca44237 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef @@ -0,0 +1,15 @@ +{ + "name": "AllIn1SpriteShaderAssembly", + "references": [ + "GUID:7ab3663edede26740845931880bf22af" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef.meta b/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef.meta new file mode 100644 index 000000000..5d7f6cdf6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 91de482a0a233614ab5962ea5f6c24ee +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo.meta b/Assets/Plugins/AllIn1SpriteShader/Demo.meta new file mode 100644 index 000000000..d4fbf7095 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8547c35f10eb6ad4697607cdde60ad3c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation.meta new file mode 100644 index 000000000..821043709 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5dda08a101e9e6f4eb3bc2eaac144b3f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller new file mode 100644 index 000000000..adf4799a2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Alpha Cutoff + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 6467778131688425141} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &3664986056586936730 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AlphaCutoff + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 2b4fb9dc8c60f4149a1699d21550ad74, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &6467778131688425141 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 3664986056586936730} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 3664986056586936730} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller.meta new file mode 100644 index 000000000..30d764dd3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d7d72c9f17b0ebe4e908dab552b82c45 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim new file mode 100644 index 000000000..626c019aa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AlphaCutoff + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0.98 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._AlphaCutoffValue + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2296261589 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0.98 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._AlphaCutoffValue + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim.meta new file mode 100644 index 000000000..18afb8f7e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2b4fb9dc8c60f4149a1699d21550ad74 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller new file mode 100644 index 000000000..b8bf9af4e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-7096875646415134801 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ShinyBoy + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 025b58e8824357d47bc58c069785117d, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AtlasSpriteBoy + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 4058490066961251321} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &4058490066961251321 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -7096875646415134801} + m_Position: {x: 260, y: 60, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -7096875646415134801} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller.meta new file mode 100644 index 000000000..1e85f9f64 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8652a2e9bd26fdf45b91d4e790b17cb1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim new file mode 100644 index 000000000..344bd58a2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blur + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 18.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._BlurIntensity + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2150532686 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 18.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._BlurIntensity + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim.meta new file mode 100644 index 000000000..53c360c45 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c5d41ccefede6154f8ae605173ef7ff2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller new file mode 100644 index 000000000..5e68654b2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-8834132420444968739 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7853909571706163922} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7853909571706163922} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blur + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -8834132420444968739} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &7853909571706163922 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blur + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: c5d41ccefede6154f8ae605173ef7ff2, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller.meta new file mode 100644 index 000000000..3e2dafa2e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4d13c3a68decb714e80835bb34f348f3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim new file mode 100644 index 000000000..2150839b2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim @@ -0,0 +1,233 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Burn + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.26666668 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.43333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.1 + value: 0 + inSlope: 0.36363637 + outSlope: 0.36363637 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2333048903 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.26666668 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.43333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.1 + value: 0 + inSlope: 0.36363637 + outSlope: 0.36363637 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim.meta new file mode 100644 index 000000000..b1393fb90 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d67d27ddcf1126d4189d14140cc10cbc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller new file mode 100644 index 000000000..a503dda1b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Burn + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 5582001109422249166} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &3750917721442123826 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Burn + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: d67d27ddcf1126d4189d14140cc10cbc, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &5582001109422249166 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 3750917721442123826} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 3750917721442123826} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller.meta new file mode 100644 index 000000000..151530939 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9d3bba413d0ce9244b743d634f8d3c27 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim new file mode 100644 index 000000000..0ca7c2218 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim @@ -0,0 +1,332 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BurningSoldier + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 24.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 35.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 15.9 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 30.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 26.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 41.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 31.1 + inSlope: -56.699993 + outSlope: -56.699993 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 22.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 31 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 27.5 + inSlope: -41.999996 + outSlope: -41.999996 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: 16.8 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 34.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.1666667 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: Burn + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 4116755002 + attribute: 2271964720 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 2.1666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 24.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 35.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 15.9 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 30.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 26.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 41.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 31.1 + inSlope: -56.699993 + outSlope: -56.699993 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 22.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 31 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 27.5 + inSlope: -41.999996 + outSlope: -41.999996 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: 16.8 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 34.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.1666667 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: Burn + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim.meta new file mode 100644 index 000000000..29f0423d9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3f0612e16135f2c4896bf79e439c17b8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller new file mode 100644 index 000000000..f9a584bde --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BurningSoldier + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 8782918891389931882} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &8782918891389931882 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 9025100736644353693} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 9025100736644353693} +--- !u!1102 &9025100736644353693 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BurningSoldier + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 3f0612e16135f2c4896bf79e439c17b8, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller.meta new file mode 100644 index 000000000..49c6e0321 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5f3b82f530c24dd48961a1d428ed91d8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim new file mode 100644 index 000000000..0f3ea0444 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim @@ -0,0 +1,395 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CrazyPattern + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.25 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.0833333 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.0833333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.9166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 3.3333333 + value: 0.00908789 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2278947341 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2301463249 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 3.3333333 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.25 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.0833333 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.0833333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.9166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 3.3333333 + value: 0.00908789 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim.meta new file mode 100644 index 000000000..bc53879a2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ad92dfbcd615b014a935ff2405b31f9d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller new file mode 100644 index 000000000..4bb3001c0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CrazyPattern + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 1107734427540884016} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1102331061419599162 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CrazyPattern + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: ad92dfbcd615b014a935ff2405b31f9d, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &1107734427540884016 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102331061419599162} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102331061419599162} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller.meta new file mode 100644 index 000000000..ecc1d3ee7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f994ff75b3f33ae46af22e6462b4606a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim new file mode 100644 index 000000000..eeb47fbb8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CustomGradient + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.75 + value: 0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ColorRampLuminosity + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2233840366 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.5 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.75 + value: 0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ColorRampLuminosity + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim.meta new file mode 100644 index 000000000..5af513660 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7f6e7a4a06cb0ed46bed4c808d5ef0fc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller new file mode 100644 index 000000000..e6f3cc1a1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CustomGradient + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 1107173670123172324} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1102237943875058834 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CustomGradient + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 7f6e7a4a06cb0ed46bed4c808d5ef0fc, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &1107173670123172324 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102237943875058834} + m_Position: {x: 384, y: 73, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102237943875058834} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller.meta new file mode 100644 index 000000000..fb08ebd13 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: edeeb31731bec5f4092bbc3bbff03e91 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim new file mode 100644 index 000000000..fe67793c9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim @@ -0,0 +1,251 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fade + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.9166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 13.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeBurnGlow + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2407006466 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.9166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 13.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeBurnGlow + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim.meta new file mode 100644 index 000000000..43e1f6c6d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e6ea2b9990f282841809c38407852410 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller new file mode 100644 index 000000000..ed6316acc --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fade + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 5715813001965171755} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &335997213937709296 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fade + m_Speed: 0.25 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: e6ea2b9990f282841809c38407852410, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &5715813001965171755 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 335997213937709296} + m_Position: {x: 252, y: 48, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 335997213937709296} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller.meta new file mode 100644 index 000000000..ca216f4a0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2025469cc6b8be543a1b93993e746b75 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller new file mode 100644 index 000000000..5fd23330b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller @@ -0,0 +1,147 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-7387446859746230137 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TeleportReverse + m_Speed: -1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -7156134355841481533} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: d55cd89bba47b6c4dbfe242daad46b9e, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-7264864826306982476 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 542486197727019260} + m_Position: {x: 290, y: 110, z: 0} + - serializedVersion: 1 + m_State: {fileID: -7387446859746230137} + m_Position: {x: 290, y: 20, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 542486197727019260} +--- !u!1101 &-7156134355841481533 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 542486197727019260} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &-6218460184888794421 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -7387446859746230137} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fill Amount 1 + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -7264864826306982476} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &542486197727019260 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Teleport + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -6218460184888794421} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: d55cd89bba47b6c4dbfe242daad46b9e, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller.meta new file mode 100644 index 000000000..0db741a33 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2cd3280111dab4e41ba2dd630db17ca4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller new file mode 100644 index 000000000..4199ee3b6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-8956218147619503351 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: FillAmount + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 96ea5fb127ca6e34e8f61e91018c6e1b, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-2648066226161793259 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -8956218147619503351} + m_Position: {x: 260, y: 60, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -8956218147619503351} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fill Amount + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -2648066226161793259} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller.meta new file mode 100644 index 000000000..39393980a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6078cf4809fc6174f90700135dcf328f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim new file mode 100644 index 000000000..57c80d1da --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: FillAmount + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.44444445 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8888889 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ClipUvRight + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 45 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2187639724 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.8888889 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.44444445 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8888889 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ClipUvRight + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim.meta new file mode 100644 index 000000000..2f2f97887 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 96ea5fb127ca6e34e8f61e91018c6e1b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller new file mode 100644 index 000000000..1f6111482 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller @@ -0,0 +1,101 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-1965812634030799034 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7173216993388856439} + m_Position: {x: 200, y: 0, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102029001882399030} + m_Position: {x: 235, y: 65, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7173216993388856439} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fish Eye + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -1965812634030799034} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1102029001882399030 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CustomGradient + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 7f6e7a4a06cb0ed46bed4c808d5ef0fc, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &7173216993388856439 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hallucination + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 8186e6a2d59204e4283c29e5abfedb85, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller.meta new file mode 100644 index 000000000..0892fbb92 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 009a1cbada3894e4387ecb3a8a39e335 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller new file mode 100644 index 000000000..87ba4681a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-9028953883465965845 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: hpBar + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 6183fddabf104ce47abe341327074864, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-8663805930458218728 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -9028953883465965845} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -9028953883465965845} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Frame + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -8663805930458218728} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller.meta new file mode 100644 index 000000000..3ca226869 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f36bce3b3e7e3c5488117e16e426deb5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim new file mode 100644 index 000000000..71da56f2c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hallucination + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.7777778 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5555556 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 45 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2206827623 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.5555556 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.7777778 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5555556 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim.meta new file mode 100644 index 000000000..85f7ad762 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8186e6a2d59204e4283c29e5abfedb85 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller new file mode 100644 index 000000000..4a6490eb7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-3029259370103312344 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1169743166369495606} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1169743166369495606} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hit Effect 1 + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -3029259370103312344} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1169743166369495606 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Rotate + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: a3c9d77a6b2549c4d8ae31057eca0fc9, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller.meta new file mode 100644 index 000000000..0ea338d40 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1cc6e3c6540cce34bb2f509398f90917 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller new file mode 100644 index 000000000..61fc3e399 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-5913550154835270090 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: HitEffect + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 769de38e4feb31b429ee5eb7b5bece71, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hit Effect + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 4195058999054830920} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &4195058999054830920 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -5913550154835270090} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -5913550154835270090} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller.meta new file mode 100644 index 000000000..7a10cb593 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c6e411a605ec50345a36bbab9d3cc722 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim new file mode 100644 index 000000000..c3316c026 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: HitEffect + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2333048903 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim.meta new file mode 100644 index 000000000..e9c17a264 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 769de38e4feb31b429ee5eb7b5bece71 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim new file mode 100644 index 000000000..9c6607c01 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim @@ -0,0 +1,323 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hologram + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.613 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.45 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5833334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.359 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 0.359 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.45 + value: 0.35901853 + inSlope: 0.0002965927 + outSlope: 0.0002965927 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5833334 + value: 0.37623176 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAlpha + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2187965785 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2229035585 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.5833334 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.613 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.45 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5833334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.359 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 0.359 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.45 + value: 0.35901853 + inSlope: 0.0002965927 + outSlope: 0.0002965927 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5833334 + value: 0.37623176 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAlpha + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim.meta new file mode 100644 index 000000000..2c2a4714e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2d06614560bbcda488c23b8708ff4c49 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim new file mode 100644 index 000000000..a9ac44955 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim @@ -0,0 +1,278 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: IceSoldier + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 3 + value: 0.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: Ice + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: Ice + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 3 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: SnowFlakesPS + classID: 1 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 4077044462 + attribute: 2271964720 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 4077044462 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 444922166 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 3 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 3 + value: 0.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: Ice + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: Ice + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 3 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: SnowFlakesPS + classID: 1 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim.meta new file mode 100644 index 000000000..169a82dca --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f8f2d0809b870954c850e5004e9b4f67 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller new file mode 100644 index 000000000..302853e1f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-1136635573635380662 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7920773727163540604} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7920773727163540604} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: IceSoldier + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -1136635573635380662} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &7920773727163540604 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: IceSoldier + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: f8f2d0809b870954c850e5004e9b4f67, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller.meta new file mode 100644 index 000000000..40feaa212 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c2df20f2d12e21b46bacd5dfa839b92e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller new file mode 100644 index 000000000..4dd9e9ea7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Impact + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 2011205658823687596} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &2011205658823687596 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 2695582658214874718} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 2695582658214874718} +--- !u!1102 &2695582658214874718 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Impact1 + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: b4a017fddcef25548ad4089f01c9da55, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller.meta new file mode 100644 index 000000000..96d86b73b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a1097444efe6cb54f86e2955982c0fe1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim new file mode 100644 index 000000000..3c766ec6c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim @@ -0,0 +1,737 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Impact1 + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.245 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FishEyeUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 0.155 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.r + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.9980566 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.g + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.9381551 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.3443396 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.b + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.a + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2187965785 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2296652321 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2301463249 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2333048903 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1455733126 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1724168582 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1187297670 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1992604038 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.245 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FishEyeUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 0.155 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.r + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.9980566 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.g + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.9381551 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.3443396 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.b + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.a + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim.meta new file mode 100644 index 000000000..e8504cc34 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b4a017fddcef25548ad4089f01c9da55 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim new file mode 100644 index 000000000..3e5e8a382 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim @@ -0,0 +1,322 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MotionBlur + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -2.59, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.33333334 + value: {x: -2.59, y: 0, z: 0} + inSlope: {x: -0, y: 0, z: 0} + outSlope: {x: 13.684616, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.76666665 + value: {x: 3.34, y: 0, z: 0} + inSlope: {x: 13.684616, y: 0, z: 0} + outSlope: {x: -7.803249, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.35 + value: 2.43 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 2.33 + inSlope: -0.9600014 + outSlope: -0.9600014 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MotionBlurDist + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2244204413 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.76666665 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -2.59 + inSlope: 0 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: -2.59 + inSlope: -0 + outSlope: 13.684616 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 3.34 + inSlope: 13.684616 + outSlope: -7.803249 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.35 + value: 2.43 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 2.33 + inSlope: -0.9600014 + outSlope: -0.9600014 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MotionBlurDist + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim.meta new file mode 100644 index 000000000..1b9e0cc34 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e618782845320624bb758db2d2b9bf0e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim new file mode 100644 index 000000000..1387133d4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Offset + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: -0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._OffsetUvX + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2328359666 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: -0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._OffsetUvX + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim.meta new file mode 100644 index 000000000..b7069cb7e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cfa3188cad768364993a043c85b5add0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller new file mode 100644 index 000000000..b9a8d8d00 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-5873563199590618010 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Offset + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: cfa3188cad768364993a043c85b5add0, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Offset + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 5176085075958421900} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &5176085075958421900 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -5873563199590618010} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -5873563199590618010} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller.meta new file mode 100644 index 000000000..b2ce9bfd9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 63273b05c4774384b85a146feb6df4d3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller new file mode 100644 index 000000000..8b7510795 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-7075512637821731064 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -2683493651811674534} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -2683493651811674534} +--- !u!1102 &-2683493651811674534 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hologram + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 2d06614560bbcda488c23b8708ff4c49, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Original + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -7075512637821731064} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller.meta new file mode 100644 index 000000000..d002ee1e2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ad5ae64e9a03a1a40889385b2d0f2b89 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim new file mode 100644 index 000000000..7309422aa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Posterize + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 6 + inSlope: 0 + outSlope: 8 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 10 + inSlope: 8 + outSlope: -8 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 6 + inSlope: -8 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PosterizeNumColors + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2351287835 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 6 + inSlope: 0 + outSlope: 8 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 10 + inSlope: 8 + outSlope: -8 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 6 + inSlope: -8 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PosterizeNumColors + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim.meta new file mode 100644 index 000000000..221132f33 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 82ee3808b395730498f393a00662e41a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller new file mode 100644 index 000000000..027f689ff --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-8832860468942279513 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -5881428344133791977} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -5881428344133791977} +--- !u!1102 &-5881428344133791977 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Posterize + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 82ee3808b395730498f393a00662e41a, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Posterize + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -8832860468942279513} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller.meta new file mode 100644 index 000000000..bc4ea5d23 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e25fb0db751a59a43bb4bd01628feb7e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim new file mode 100644 index 000000000..1929a1fa8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RadialFillAmount + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RadialClip2 + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2304530698 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RadialClip2 + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim.meta new file mode 100644 index 000000000..2bd90041f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fee541ce475b5ae4c9d0ddad66e4d464 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller new file mode 100644 index 000000000..35fbd00ab --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-2648066226161793259 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102919259890989908} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102919259890989908} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RadialFillAmount + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -2648066226161793259} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1102919259890989908 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RadialFillAmount + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: fee541ce475b5ae4c9d0ddad66e4d464, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller.meta new file mode 100644 index 000000000..a4a4c0af6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f325edee1e9fb044eb0d87aad6d3ece0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim new file mode 100644 index 000000000..573f40ea0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim @@ -0,0 +1,116 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Rotate + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 18.84 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 6.28 + inSlope: 18.84 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2278947341 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.33333334 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 18.84 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 6.28 + inSlope: 18.84 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim.meta new file mode 100644 index 000000000..c2ed83d4e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a3c9d77a6b2549c4d8ae31057eca0fc9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller new file mode 100644 index 000000000..2c5a9e247 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-3120651885421920482 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Rotate + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: a3c9d77a6b2549c4d8ae31057eca0fc9, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Rotate + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 2449547186783014002} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &2449547186783014002 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -3120651885421920482} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -3120651885421920482} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller.meta new file mode 100644 index 000000000..0bffd5adf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1243dd8a666ff6b4787a02084a5170d1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim new file mode 100644 index 000000000..3c95cfe1a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ScreenHit + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Alpha + path: HitSprite + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 3618885906 + attribute: 2333735666 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Alpha + path: HitSprite + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim.meta new file mode 100644 index 000000000..71750e721 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0f35df6c475fd3a47a801523e733c87a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller new file mode 100644 index 000000000..216b7f707 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-5761580113761073130 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ScreenHit + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 0f35df6c475fd3a47a801523e733c87a, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ScreenHit + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 4855511007839786432} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &4855511007839786432 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -5761580113761073130} + m_Position: {x: 216, y: 48, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -5761580113761073130} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller.meta new file mode 100644 index 000000000..eb5265be5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1220612ba20667d46a6e8356073b69b0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller new file mode 100644 index 000000000..b386d6856 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-4642615002787253909 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 392135796101470953} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 392135796101470953} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shield Soldier + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -4642615002787253909} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &392135796101470953 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ShieldSparksPS + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 4f4343d48a0bd474fa2c4abc51d18cc1, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller.meta new file mode 100644 index 000000000..926b0440e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 48122208e82681f45a0f7dda84aa301f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim new file mode 100644 index 000000000..d40b8a5ad --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim @@ -0,0 +1,601 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ShieldSparksPS + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -0.058, y: -1.801, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.5 + value: {x: -0.058, y: 1.878, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.53333336 + value: {x: -0.058, y: 1.878, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1.4833333 + value: {x: -0.058, y: 1.8665462, z: -0.1} + inSlope: {x: 0, y: -0.0022222255, z: 0} + outSlope: {x: 0, y: -0.0022222255, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1.5 + value: {x: -0.058, y: 1.8660091, z: -0.1} + inSlope: {x: 0, y: -0.004157712, z: 0} + outSlope: {x: 0, y: -0.004157712, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 2 + value: {x: -0.058, y: -1.78, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 2.5 + value: {x: -0.058, y: 1.8660091, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: ShieldSparksPS + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: Shield + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: EmissionModule.rateOverTime.scalar + path: ShieldSparksPS + classID: 198 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 88045128 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 423614430 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 88045128 + attribute: 2883525743 + script: {fileID: 0} + typeID: 198 + customType: 27 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 2.5 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: Shield + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: ShieldSparksPS + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -1.801 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 1.878 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: 1.878 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 1.8665462 + inSlope: -0.0022222255 + outSlope: -0.0022222255 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 1.8660091 + inSlope: -0.004157712 + outSlope: -0.004157712 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: -1.78 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 1.8660091 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: ShieldSparksPS + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: ShieldSparksPS + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: EmissionModule.rateOverTime.scalar + path: ShieldSparksPS + classID: 198 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim.meta new file mode 100644 index 000000000..829682b93 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4f4343d48a0bd474fa2c4abc51d18cc1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim new file mode 100644 index 000000000..756ae3523 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim @@ -0,0 +1,152 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shine + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ShineLocation + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2326997892 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.5 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ShineLocation + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim.meta new file mode 100644 index 000000000..d38df5923 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a5367530cc5998b4ea48fb27bde9ad47 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller new file mode 100644 index 000000000..e6abbcc05 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-8306752329881989475 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7241695106506440127} + m_Position: {x: 280, y: 80, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7241695106506440127} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shine + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -8306752329881989475} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &7241695106506440127 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shine + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: a5367530cc5998b4ea48fb27bde9ad47, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller.meta new file mode 100644 index 000000000..d63d4fe3b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1b6613bf9b3fea94380070ae23178552 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim new file mode 100644 index 000000000..7057cf50b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim @@ -0,0 +1,179 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ShinyBoy + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 360 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 360 + inSlope: 360 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ShineLocation + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 30 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2206827623 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2326997892 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 360 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 360 + inSlope: 360 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ShineLocation + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim.meta new file mode 100644 index 000000000..30a5a513a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 025b58e8824357d47bc58c069785117d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller new file mode 100644 index 000000000..618363fb8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-7618782969959717699 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -4193363627458388406} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -4193363627458388406} +--- !u!1102 &-4193363627458388406 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SoldierRun + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: f66460fd2ad94fc48953b837ae43d577, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Soldier + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -7618782969959717699} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller.meta new file mode 100644 index 000000000..d9e371199 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2f06abfb8d5c7014299913ef4dbc450d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim new file mode 100644 index 000000000..6c1a89f6d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim @@ -0,0 +1,458 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SoldierRun + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: -0.075 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._OffsetUvY + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.x + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.y + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.z + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.w + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2378220132 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 377931145 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 109495689 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 646366601 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 914802057 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.16666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: -0.075 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._OffsetUvY + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.x + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.y + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.z + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.w + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim.meta new file mode 100644 index 000000000..2ad465487 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f66460fd2ad94fc48953b837ae43d577 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller new file mode 100644 index 000000000..a5687d37e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-3627288444216986430 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MotionBlur + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: e618782845320624bb758db2d2b9bf0e, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-2709104361246388160 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -3627288444216986430} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -3627288444216986430} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Sprite + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -2709104361246388160} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller.meta new file mode 100644 index 000000000..3166483c8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 33212171a9274b947914d32a914af1a3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim new file mode 100644 index 000000000..80b911b70 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim @@ -0,0 +1,215 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Teleport + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.85 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.85 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 100 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2301463249 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.85 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.85 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.85 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim.meta new file mode 100644 index 000000000..6d5017a6b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d55cd89bba47b6c4dbfe242daad46b9e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller new file mode 100644 index 000000000..b4206560e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller @@ -0,0 +1,147 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-7822484566270033091 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TwistDisappearInverse + m_Speed: -1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 4044203229998360206} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 0b970b1c29876434a90d1b416c2a79da, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &-5714200180160972232 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -7822484566270033091} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &-2059169651024962981 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TwistDisappear + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -5714200180160972232} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 0b970b1c29876434a90d1b416c2a79da, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Twist 1 + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 7170545140116765573} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1101 &4044203229998360206 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -2059169651024962981} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1107 &7170545140116765573 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -2059169651024962981} + m_Position: {x: 330, y: 100, z: 0} + - serializedVersion: 1 + m_State: {fileID: -7822484566270033091} + m_Position: {x: 330, y: 30, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -2059169651024962981} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller.meta new file mode 100644 index 000000000..6080224f6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fe198228e3a49df4b966ab214ec9cde5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim new file mode 100644 index 000000000..5b4946eed --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Twist + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 1.56 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._TwistUvAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 40 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2296183723 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 1.56 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._TwistUvAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim.meta new file mode 100644 index 000000000..0ced0258d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4d7af8b9ba927a74ca451c409cb63239 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller new file mode 100644 index 000000000..0f365ff2f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-94178637910970603 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7878794423122388568} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7878794423122388568} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Twist + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -94178637910970603} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &7878794423122388568 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Twist + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 4d7af8b9ba927a74ca451c409cb63239, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller.meta new file mode 100644 index 000000000..0d02837d7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ed827ed402dcef3458313b21158b5c7c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim new file mode 100644 index 000000000..f546044d9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim @@ -0,0 +1,647 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TwistDisappear + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 1.58 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 1.58 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._TwistUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Alpha + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2278947341 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2296183723 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2301463249 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2333735666 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2271964720 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2206827623 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.4833333 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 1.58 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 1.58 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._TwistUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Alpha + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim.meta new file mode 100644 index 000000000..824312e88 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0b970b1c29876434a90d1b416c2a79da +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim new file mode 100644 index 000000000..3f8e6974b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Zoom + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.87 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0.21 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0.87 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ZoomUvAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2208268607 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.87 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0.21 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0.87 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ZoomUvAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim.meta new file mode 100644 index 000000000..619bcdb0b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 609d80679704fe540a7be47d8ddd8eef +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller new file mode 100644 index 000000000..f2c1c042e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-1086332058936838499 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Zoom + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 609d80679704fe540a7be47d8ddd8eef, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Zoom + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 8956640337037327091} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &8956640337037327091 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -1086332058936838499} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -1086332058936838499} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller.meta new file mode 100644 index 000000000..121c74f9a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f63147b3bd9ae6949be2ad05c6679dd5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim new file mode 100644 index 000000000..f1eb29eab --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: hpBar + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ClipUvRight + path: Front + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 1060785650 + attribute: 2187639724 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ClipUvRight + path: Front + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim.meta new file mode 100644 index 000000000..bcb833f81 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6183fddabf104ce47abe341327074864 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity new file mode 100644 index 000000000..d67e0bbef --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity @@ -0,0 +1,56947 @@ +%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: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + 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, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 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: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + 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!21 &7746739 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.016 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &14374124 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 14374125} + - component: {fileID: 14374127} + - component: {fileID: 14374126} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &14374125 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 14374124} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 290590332} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &14374126 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 14374124} + m_Text: Regular Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &14374127 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 14374124} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &42135249 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 42135250} + - component: {fileID: 42135253} + - component: {fileID: 42135252} + m_Layer: 0 + m_Name: SpookySoldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &42135250 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42135249} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 250, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 437846756} + - {fileID: 2099543392} + m_Father: {fileID: 1563905016} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &42135252 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42135249} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &42135253 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42135249} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 753155718} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &42378786 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 42378787} + - component: {fileID: 42378789} + - component: {fileID: 42378788} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &42378787 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42378786} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 368348656} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &42378788 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42378786} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &42378789 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42378786} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &47460683 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 47460684} + - component: {fileID: 47460687} + - component: {fileID: 47460686} + - component: {fileID: 47460688} + m_Layer: 0 + m_Name: Colors + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &47460684 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47460683} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 100, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1022452601} + - {fileID: 588736392} + m_Father: {fileID: 1563905016} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &47460686 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47460683} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &47460687 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47460683} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 473fd0e814452c4488d6794c3f24dff1, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &47460688 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47460683} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _HsvShift + scrollSpeed: 500 + applyModulo: 1 + modulo: 360 + mat: {fileID: 0} +--- !u!1 &55667222 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4825911116503289154} + - component: {fileID: 55667224} + - component: {fileID: 55667225} + m_Layer: 0 + m_Name: Original + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &55667224 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 55667222} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1257475202} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &55667225 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 55667222} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &56751282 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 56751283} + - component: {fileID: 56751286} + - component: {fileID: 56751285} + m_Layer: 0 + m_Name: Original + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &56751283 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + 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: + - {fileID: 124843813} + - {fileID: 646019452} + m_Father: {fileID: 1351315063} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &56751285 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &56751286 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1735095770} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &69675090 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 69675091} + - component: {fileID: 69675093} + - component: {fileID: 69675092} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &69675091 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 69675090} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 353408739} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &69675092 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 69675090} + m_Text: Hallucination + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &69675093 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 69675090} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &70619476 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ALPHACUTOFF_ON ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON PIXELATE_ON + _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.904 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0159 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 70 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &72928926 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA HOLOGRAM_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1.2 + - _HologramMinAlpha: 0.142 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 0.085 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 7 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 0.27421054, b: 0.38679248, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &73084414 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA HSV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1.5 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &85408337 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &87388692 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA POLARUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 4, y: 4} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &98126757 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 98126758} + - component: {fileID: 98126760} + - component: {fileID: 98126759} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &98126758 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98126757} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 407134450} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &98126759 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98126757} + m_Text: Doodle + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &98126760 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98126757} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &98690188 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 98690189} + - component: {fileID: 98690191} + - component: {fileID: 98690190} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &98690189 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98690188} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1111461197} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &98690190 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98690188} + m_Text: Pinch + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &98690191 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98690188} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &102412576 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 102412577} + - component: {fileID: 102412578} + m_Layer: 0 + m_Name: Magic Tornado + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &102412577 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 102412576} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 210, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 582549648} + - {fileID: 799318216} + - {fileID: 1454273602} + - {fileID: 595980604} + - {fileID: 1586363708} + m_Father: {fileID: 1563905016} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &102412578 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 102412576} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &108846146 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORSWAP_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.09 + - _ColorSwapRedLuminosity: 0.604 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapRed: {r: 0, g: 0.5643088, b: 0.8396226, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &111852238 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GRADIENT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.858 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &114782626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 114782627} + - component: {fileID: 114782629} + - component: {fileID: 114782628} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &114782627 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114782626} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 499272004} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &114782628 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114782626} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &114782629 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114782626} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &124794630 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 124794631} + - component: {fileID: 124794633} + - component: {fileID: 124794632} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &124794631 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124794630} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 950130248} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &124794632 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124794630} + m_Text: Grass + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &124794633 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124794630} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &124843812 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 124843813} + - component: {fileID: 124843815} + - component: {fileID: 124843814} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &124843813 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124843812} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 56751283} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &124843814 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124843812} + m_Text: Original Sprite + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &124843815 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124843812} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &133362205 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 133362206} + - component: {fileID: 133362208} + - component: {fileID: 133362207} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &133362206 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 133362205} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 746759203} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &133362207 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 133362205} + m_Text: Hit Effect + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &133362208 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 133362205} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &136921168 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 136921169} + - component: {fileID: 136921171} + - component: {fileID: 136921170} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &136921169 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 136921168} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1120052622} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &136921170 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 136921168} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &136921171 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 136921168} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &139334897 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CLIPPING_ON ETC1_EXTERNAL_ALPHA ROTATEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0.1 + - _ClipUvLeft: 0.1 + - _ClipUvRight: 0.1 + - _ClipUvUp: 0.1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 2.66 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &144455307 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 144455308} + - component: {fileID: 144455310} + - component: {fileID: 144455309} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &144455308 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144455307} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 642204093} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &144455309 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144455307} + m_Text: Screen Hit + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &144455310 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144455307} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &150333392 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GHOST_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1.41 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &152938703 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 152938704} + - component: {fileID: 152938706} + - component: {fileID: 152938705} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &152938704 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 152938703} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1875180451} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &152938705 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 152938703} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &152938706 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 152938703} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &154474730 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 154474731} + - component: {fileID: 154474733} + - component: {fileID: 154474732} + m_Layer: 5 + m_Name: Controls + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &154474731 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154474730} + 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: 564363701} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1734.6, y: 127.8} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &154474732 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154474730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_FontSize: 56 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 79 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: 'Controls: Use WASD or Arrow Keys to move around' +--- !u!222 &154474733 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154474730} + m_CullTransparentMesh: 0 +--- !u!1 &156196756 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 156196757} + - component: {fileID: 156196759} + - component: {fileID: 156196758} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &156196757 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 156196756} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 361311995} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &156196758 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 156196756} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &156196759 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 156196756} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &164406718 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 164406719} + - component: {fileID: 164406721} + - component: {fileID: 164406720} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &164406719 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164406718} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1901854650} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &164406720 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164406718} + m_Text: Offset + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &164406721 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164406718} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &166039412 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 166039413} + - component: {fileID: 166039415} + m_Layer: 0 + m_Name: Round Wave + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &166039413 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 166039412} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 40, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1688633194} + - {fileID: 1100636068} + - {fileID: 924727831} + m_Father: {fileID: 1351315063} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &166039415 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 166039412} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &168046140 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 168046141} + - component: {fileID: 168046143} + - component: {fileID: 168046142} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &168046141 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168046140} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 420059981} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &168046142 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168046140} + m_Text: Shadow + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &168046143 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168046140} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &183278329 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA WIND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.437 + - _FadeBurnGlow: 6.6 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 6.9 + - _GrassWind: 14.7 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &195375977 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON OUTBASE8DIR_ON PINCH_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: dbaa905cec0d2b944b5d1ebdbc3ceb1e, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.391 + - _FadeBurnGlow: 1.9 + - _FadeBurnTransition: 0.274 + - _FadeBurnWidth: 0.07 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0141 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 0, g: 0.9400835, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.94117653, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &208665463 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA WAVEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 11.71 + - _WaveStrength: 11.52 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &212554433 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CLIPPING_ON ETC1_EXTERNAL_ALPHA WAVEUV_ON WIND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0.1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 1.5 + - _GrassWind: 1.9 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 1.5 + - _WaveSpeed: 6.7 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &217718272 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CHANGECOLOR2_ON CHANGECOLOR3_ON COLORSWAP_ON ETC1_EXTERNAL_ALPHA + GLOWTEX_ON GRADIENT2COL_ON GRADIENT_ON OUTBASE8DIR_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 4abae6e7a5c534a4c8e95edf12a7d0c9, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.28 + - _ColorSwapRedLuminosity: 0.481 + - _Contrast: 3.29 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.4 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 6 + - _InnerOutlineThickness: 1.31 + - _MaxXUV: 0.97509766 + - _MaxYUV: 0.9902344 + - _MinXUV: 0.68408203 + - _MinYUV: 0.6455078 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 5.1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0321 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.059 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 0.1 + - _RoundWaveStrength: 0.014 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7.4 + - _WaveSpeed: 11.1 + - _WaveStrength: 16.4 + - _WaveX: 0.496 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.9716981, g: 0.1283375, b: 0.46596614, a: 1} + - _ColorSwapGreen: {r: 3.0196679, g: 1.6945816, b: 0, a: 1} + - _ColorSwapRed: {r: 0.24279101, g: 0.56585985, b: 0.8301887, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.98823535, g: 0.6392157, b: 0.6117647, a: 1} + - _GradBotLeftCol: {r: 0.16037738, g: 0.16037738, b: 0.16037738, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 0.103773594, g: 0.103773594, b: 0.103773594, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 0.9811321, g: 0.29619083, b: 0.7939467, a: 1} + - _OutlineColor: {r: 0.5896226, g: 0.1792453, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &242385328 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 242385329} + - component: {fileID: 242385332} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &242385329 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242385328} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 160, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 928177173} + - {fileID: 942262413} + - {fileID: 1673476643} + - {fileID: 1949787730} + m_Father: {fileID: 1563905016} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &242385332 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242385328} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &242658909 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 242658910} + - component: {fileID: 242658912} + - component: {fileID: 242658911} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &242658910 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242658909} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 2096881075} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &242658911 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242658909} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &242658912 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242658909} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &245082890 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 245082891} + - component: {fileID: 245082893} + - component: {fileID: 245082892} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &245082891 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245082890} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 642204093} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &245082892 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245082890} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &245082893 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245082890} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &252177635 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 252177636} + - component: {fileID: 252177639} + - component: {fileID: 252177638} + m_Layer: 0 + m_Name: Gameboy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &252177636 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 605528100} + - {fileID: 2004669564} + m_Father: {fileID: 1563905016} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &252177638 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &252177639 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 288262069} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &266318147 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 266318148} + - component: {fileID: 266318150} + - component: {fileID: 266318149} + m_Layer: 0 + m_Name: HitSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &266318148 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 266318147} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 227.2355, y: 122.83, z: 122.83} + m_Children: [] + m_Father: {fileID: 642204093} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &266318149 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 266318147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &266318150 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 266318147} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1956560312} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 839adabbc5de26041bac66450214a831, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &269805653 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 269805654} + - component: {fileID: 269805656} + - component: {fileID: 269805655} + m_Layer: 0 + m_Name: Back + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &269805654 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 269805653} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.01} + m_LocalScale: {x: 0.9196, y: 0.65, z: 1} + m_Children: [] + m_Father: {fileID: 540070583} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &269805655 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 269805653} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &269805656 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 269805653} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1024727761} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: fab06e0be9375cc4d823efa71629885c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &275948669 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 275948670} + - component: {fileID: 275948672} + - component: {fileID: 275948671} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &275948670 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 275948669} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 485976056} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &275948671 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 275948669} + m_Text: Glitch + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &275948672 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 275948669} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &288262069 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON OUTBASE8DIR_ON OUTBASE_ON + PIXELATE_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 285a35f6ccf7b1a44b6c198e96105173, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.531 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.75 + - _ColorSwapGreenLuminosity: 0.264 + - _ColorSwapRedLuminosity: 0.75 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.437 + - _FadeBurnGlow: 6.6 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 2.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 6.9 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0539 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 40 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 1.61 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.41037738, g: 0.5180799, b: 1, a: 1} + - _ColorSwapGreen: {r: 0, g: 1, b: 0.96124196, a: 1} + - _ColorSwapRed: {r: 0.9528302, g: 0.783215, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!4 &290590332 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 30, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 14374125} + - {fileID: 1511231070} + m_Father: {fileID: 2036092933} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &290590333 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 290590332} + - component: {fileID: 290590335} + - component: {fileID: 290590336} + m_Layer: 0 + m_Name: Outline1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &290590335 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 7746739} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &290590336 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &294421775 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 294421776} + - component: {fileID: 294421778} + - component: {fileID: 294421777} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &294421776 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 294421775} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1229041066} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &294421777 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 294421775} + m_Text: HueShift + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &294421778 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 294421775} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &297942434 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 297942435} + - component: {fileID: 297942437} + - component: {fileID: 297942436} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &297942435 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297942434} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1123731223} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &297942436 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297942434} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &297942437 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297942434} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &298142066 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 298142067} + - component: {fileID: 298142069} + - component: {fileID: 298142068} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &298142067 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298142066} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 939106332} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &298142068 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298142066} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &298142069 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298142066} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &298228098 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 298228099} + - component: {fileID: 298228101} + - component: {fileID: 298228100} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &298228099 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298228098} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1374997139} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &298228100 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298228098} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &298228101 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298228098} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &302907434 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA POSTERIZE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &305999440 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 305999441} + - component: {fileID: 305999443} + - component: {fileID: 305999442} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &305999441 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305999440} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 972134371} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &305999442 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305999440} + m_Text: Distortion + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &305999443 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305999440} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &312669277 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 312669278} + - component: {fileID: 312669281} + - component: {fileID: 312669280} + m_Layer: 0 + m_Name: AlphaOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &312669278 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312669277} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 60, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1438024880} + - {fileID: 706131457} + m_Father: {fileID: 2036092933} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &312669280 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312669277} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &312669281 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312669277} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2076240280} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &313393139 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON OUTTEX_ON _OUTLINE8DIRECTIONS_ON + _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.011 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &316406007 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 316406008} + - component: {fileID: 316406010} + - component: {fileID: 316406009} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &316406008 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316406007} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 597182738} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &316406009 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316406007} + m_Text: Color Ramp + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &316406010 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316406007} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &316897174 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 316897175} + - component: {fileID: 316897177} + - component: {fileID: 316897176} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &316897175 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316897174} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1286689243} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &316897176 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316897174} + m_Text: Hologram + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &316897177 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316897174} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &317082044 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 317082045} + - component: {fileID: 317082047} + - component: {fileID: 317082046} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &317082045 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 317082044} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 586081879} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &317082046 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 317082044} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &317082047 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 317082044} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &322195377 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 322195378} + - component: {fileID: 322195380} + - component: {fileID: 322195379} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &322195378 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322195377} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1028271463} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &322195379 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322195377} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &322195380 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322195377} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &323921624 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CLIPPING_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0.394 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &326244154 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 326244155} + - component: {fileID: 326244157} + - component: {fileID: 326244156} + m_Layer: 0 + m_Name: Obstacle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &326244155 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 326244154} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -0.74, z: -0.025} + m_LocalScale: {x: 0.14763856, y: 0.40729, z: 0.40729} + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &326244156 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 326244154} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &326244157 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 326244154} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 212554433} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: cf7e1f6ebb800154db2b215cba9330ee, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &327735240 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON CLIPPING_ON CUSTOMBLENDING_ON DISTORT_ON ETC1_EXTERNAL_ALPHA + GLOW_ON WAVEUV_ON WIND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 100 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0.03 + - _ClipUvRight: 0 + - _ClipUvUp: 0.042 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.81 + - _DistortTexXSpeed: -1 + - _DistortTexYSpeed: -5.9 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 7.7 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 5.7 + - _GrassWind: 5.2 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 0.6775423, b: 0, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.047169805, b: 0.07456907, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &337231024 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 337231025} + - component: {fileID: 337231027} + - component: {fileID: 337231026} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &337231025 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 337231024} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2082220742} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &337231026 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 337231024} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &337231027 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 337231024} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &352221783 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 352221784} + - component: {fileID: 352221786} + - component: {fileID: 352221785} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &352221784 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 352221783} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1434614528} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &352221785 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 352221783} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &352221786 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 352221783} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &353408738 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 353408739} + - component: {fileID: 353408742} + - component: {fileID: 353408741} + - component: {fileID: 353408743} + m_Layer: 0 + m_Name: Hallucination + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &353408739 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 110, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 69675091} + - {fileID: 684127073} + m_Father: {fileID: 1563905016} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &353408741 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &353408742 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2054684528} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &353408743 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 009a1cbada3894e4387ecb3a8a39e335, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &355247222 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 355247223} + - component: {fileID: 355247225} + - component: {fileID: 355247224} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &355247223 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 355247222} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1123731223} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &355247224 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 355247222} + m_Text: Overlay Texture + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &355247225 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 355247222} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &356332865 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 356332866} + - component: {fileID: 356332869} + - component: {fileID: 356332868} + - component: {fileID: 356332867} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &356332866 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + 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: 564363701} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &356332867 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &356332868 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 1774554235} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &356332869 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_CullTransparentMesh: 0 +--- !u!1 &357954208 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 357954209} + - component: {fileID: 357954212} + - component: {fileID: 357954211} + m_Layer: 0 + m_Name: TwistedFace + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &357954209 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 357954208} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 260, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 2008035789} + - {fileID: 1869989730} + m_Father: {fileID: 1563905016} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &357954211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 357954208} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &357954212 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 357954208} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1349909629} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &361311994 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 361311995} + - component: {fileID: 361311998} + - component: {fileID: 361311997} + m_Layer: 0 + m_Name: Wind + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &361311995 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 361311994} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2076635524} + - {fileID: 156196757} + m_Father: {fileID: 1351315063} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &361311997 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 361311994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &361311998 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 361311994} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 183278329} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &367923810 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 367923811} + - component: {fileID: 367923813} + - component: {fileID: 367923812} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &367923811 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367923810} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1050471976} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &367923812 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367923810} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &367923813 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367923810} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &368348655 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 368348656} + - component: {fileID: 368348658} + - component: {fileID: 368348659} + m_Layer: 0 + m_Name: Ghost + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &368348656 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 220, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1471800765} + - {fileID: 42378787} + m_Father: {fileID: 2036092933} + m_RootOrder: 22 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &368348658 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 150333392} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &368348659 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &376742881 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 376742882} + - component: {fileID: 376742884} + - component: {fileID: 376742883} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &376742882 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376742881} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1813870144} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &376742883 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376742881} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &376742884 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376742881} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &396641005 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 396641006} + - component: {fileID: 396641008} + - component: {fileID: 396641007} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &396641006 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 396641005} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1934762264} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &396641007 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 396641005} + m_Text: Burn + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &396641008 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 396641005} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &401883083 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 401883084} + - component: {fileID: 401883086} + - component: {fileID: 401883085} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &401883084 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 401883083} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 471382084} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &401883085 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 401883083} + m_Text: Inner Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &401883086 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 401883083} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &407134449 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 407134450} + - component: {fileID: 407134453} + - component: {fileID: 407134452} + - component: {fileID: 407134451} + m_Layer: 0 + m_Name: Doodle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &407134450 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407134449} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 230, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 98126758} + - {fileID: 415056644} + m_Father: {fileID: 1563905016} + m_RootOrder: 23 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &407134451 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407134449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &407134452 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407134449} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1459191230} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 73d3cc63327012249b4f98eb9289311d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &407134453 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407134449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &409423830 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 409423831} + - component: {fileID: 409423832} + m_Layer: 0 + m_Name: Mask + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &409423831 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409423830} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 3.2125397, y: 4.672785, z: 4.672785} + m_Children: [] + m_Father: {fileID: 1756331349} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!331 &409423832 +SpriteMask: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409423830} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_Sprite: {fileID: 21300000, guid: 4b40fc0f65c85f14fbc9c7c5f40ca686, type: 3} + m_MaskAlphaCutoff: 0.2 + m_FrontSortingLayerID: 0 + m_BackSortingLayerID: 0 + m_FrontSortingLayer: 0 + m_BackSortingLayer: 0 + m_FrontSortingOrder: 0 + m_BackSortingOrder: 0 + m_IsCustomRangeActive: 0 + m_SpriteSortPoint: 0 +--- !u!1 &415056643 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 415056644} + - component: {fileID: 415056646} + - component: {fileID: 415056645} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &415056644 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415056643} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 407134450} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &415056645 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415056643} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &415056646 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415056643} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!4 &419407226 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419407227} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 40, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 849687025} + - {fileID: 846281939} + m_Father: {fileID: 2036092933} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &419407227 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 419407226} + - component: {fileID: 419407229} + - component: {fileID: 419407230} + m_Layer: 0 + m_Name: Outline2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &419407229 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419407227} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 313393139} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &419407230 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419407227} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &419511669 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 419511670} + - component: {fileID: 419511672} + - component: {fileID: 419511671} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &419511670 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419511669} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 584220654} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &419511671 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419511669} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &419511672 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419511669} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &420059980 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 420059981} + - component: {fileID: 420059983} + - component: {fileID: 420059984} + m_Layer: 0 + m_Name: Shadow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &420059981 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420059980} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 270, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 168046141} + - {fileID: 820886078} + m_Father: {fileID: 2036092933} + m_RootOrder: 27 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &420059983 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420059980} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1105303541} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &420059984 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420059980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &427761888 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 427761889} + - component: {fileID: 427761891} + - component: {fileID: 427761890} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &427761889 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427761888} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1931308735} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &427761890 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427761888} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &427761891 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427761888} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &430987701 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON ETC1_EXTERNAL_ALPHA HITEFFECT_ON OUTBASE8DIR_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 6.8 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 193 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.091 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0.46328974, g: 0, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &435111025 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 435111026} + - component: {fileID: 435111028} + - component: {fileID: 435111027} + m_Layer: 0 + m_Name: Outline3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &435111026 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435111025} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.11, y: -0.66, z: 0.05} + m_LocalScale: {x: 1.0657709, y: 1.0657709, z: 1.0657709} + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &435111027 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435111025} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &435111028 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435111025} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 2fff2435ee99439438c463e2ce768283, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &437846755 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 437846756} + - component: {fileID: 437846758} + - component: {fileID: 437846757} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &437846756 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 437846755} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 42135250} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &437846757 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 437846755} + m_Text: Spooky Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &437846758 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 437846755} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &443722313 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 443722314} + - component: {fileID: 443722316} + - component: {fileID: 443722315} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &443722314 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443722313} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1931308735} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &443722315 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443722313} + m_Text: Color Swap + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &443722316 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443722313} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &443772010 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 443772011} + - component: {fileID: 443772014} + - component: {fileID: 443772013} + m_Layer: 0 + m_Name: Texture Scroll + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &443772011 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443772010} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 80, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1618143722} + - {fileID: 1939042051} + m_Father: {fileID: 1351315063} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &443772013 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443772010} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &443772014 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443772010} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1230234141} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &450696183 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 450696184} + - component: {fileID: 450696188} + - component: {fileID: 450696185} + - component: {fileID: 450696187} + m_Layer: 0 + m_Name: Procedural Soldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &450696184 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450696183} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 290, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1727216260} + - {fileID: 746778958} + m_Father: {fileID: 1563905016} + m_RootOrder: 29 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &450696185 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450696183} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4ef3964599ee48c4ea5a4ecf012ed949, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &450696187 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450696183} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &450696188 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450696183} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2066467196} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &453643567 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA ONLYOUTLINE_ON OUTBASE8DIR_ON OUTBASE_ON + _ONLYOUTLINE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 1 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.012 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &453652827 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 453652828} + - component: {fileID: 453652830} + - component: {fileID: 453652829} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &453652828 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 453652827} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1613686741} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &453652829 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 453652827} + m_Text: Fade + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &453652830 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 453652827} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &465147594 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GRADIENT_ON RADIALGRADIENT_ON _GRADISRADIAL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.876 + - _GradBoostX: 0.98 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0.28235295, b: 0.05495002, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 0.9940848, g: 1, b: 0.3679245, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &469847421 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DOODLE_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 3.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.82 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.7193959, b: 0.1273585, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &471382083 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 471382084} + - component: {fileID: 471382086} + - component: {fileID: 471382087} + m_Layer: 0 + m_Name: Inner Outline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &471382084 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 70, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 401883084} + - {fileID: 720867420} + m_Father: {fileID: 2036092933} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &471382086 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 537809413} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &471382087 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &482750998 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 482750999} + - component: {fileID: 482751001} + - component: {fileID: 482751000} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &482750999 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482750998} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &482751000 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482750998} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &482751001 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482750998} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &485976055 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 485976056} + - component: {fileID: 485976058} + - component: {fileID: 485976059} + m_Layer: 0 + m_Name: Glitch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &485976056 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 485976055} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 250, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 275948670} + - {fileID: 566664014} + m_Father: {fileID: 2036092933} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &485976058 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 485976055} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1181865632} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &485976059 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 485976055} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &487308174 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 487308175} + - component: {fileID: 487308177} + - component: {fileID: 487308176} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &487308175 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 487308174} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1329663900} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &487308176 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 487308174} + m_Text: Poolar Coords + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &487308177 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 487308174} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &489557968 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 489557969} + - component: {fileID: 489557971} + - component: {fileID: 489557970} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &489557969 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 489557968} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1675838108} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &489557970 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 489557968} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &489557971 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 489557968} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &499272003 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 499272004} + - component: {fileID: 499272007} + - component: {fileID: 499272006} + m_Layer: 0 + m_Name: BlurredOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &499272004 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499272003} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 270, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1916465496} + - {fileID: 2064997618} + - {fileID: 114782627} + m_Father: {fileID: 1563905016} + m_RootOrder: 27 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &499272006 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499272003} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &499272007 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499272003} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1439702669} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &499438416 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 499438417} + - component: {fileID: 499438419} + - component: {fileID: 499438418} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &499438417 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499438416} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1986728942} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &499438418 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499438416} + m_Text: Zoom + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &499438419 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499438416} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &510732447 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 510732448} + - component: {fileID: 510732450} + - component: {fileID: 510732449} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &510732448 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510732447} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1073973762} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &510732449 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510732447} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &510732450 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510732447} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &511167260 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 511167261} + - component: {fileID: 511167265} + - component: {fileID: 511167264} + - component: {fileID: 511167262} + - component: {fileID: 511167266} + m_Layer: 0 + m_Name: IceSoldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &511167261 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 350, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 711155183} + - {fileID: 1078196207} + - {fileID: 1527473307} + - {fileID: 1884970177} + m_Father: {fileID: 1563905016} + m_RootOrder: 35 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!331 &511167262 +SpriteMask: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_MaskAlphaCutoff: 0.2 + m_FrontSortingLayerID: 0 + m_BackSortingLayerID: 0 + m_FrontSortingLayer: 0 + m_BackSortingLayer: 0 + m_FrontSortingOrder: 0 + m_BackSortingOrder: 0 + m_IsCustomRangeActive: 0 + m_SpriteSortPoint: 0 +--- !u!114 &511167264 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &511167265 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: d27799974f79b894196aeeef8bac53af, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &511167266 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: c2df20f2d12e21b46bacd5dfa839b92e, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &520963777 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 520963778} + - component: {fileID: 520963780} + - component: {fileID: 520963779} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &520963778 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520963777} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1875180451} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &520963779 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520963777} + m_Text: Teleport + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &520963780 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520963777} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &535274221 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 535274222} + - component: {fileID: 535274224} + - component: {fileID: 535274223} + m_Layer: 5 + m_Name: ExpositorTitleOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &535274222 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 535274221} + 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: + - {fileID: 1005972827} + m_Father: {fileID: 564363701} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -87} + m_SizeDelta: {x: 160, y: 121.23} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &535274223 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 535274221} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 0 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_FontSize: 123 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 123 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Color Effects +--- !u!222 &535274224 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 535274221} + m_CullTransparentMesh: 0 +--- !u!21 &537809413 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA INNEROUTLINE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 10 + - _InnerOutlineThickness: 2.01 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0.2028302, b: 0.9452239, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &540070582 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 540070583} + - component: {fileID: 540070586} + - component: {fileID: 540070585} + - component: {fileID: 540070584} + m_Layer: 0 + m_Name: Frame + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &540070583 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540070582} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 6.839, y: 1.962, z: 1} + m_Children: + - {fileID: 269805654} + - {fileID: 1120672005} + m_Father: {fileID: 1211354477} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &540070584 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540070582} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: f36bce3b3e7e3c5488117e16e426deb5, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &540070585 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540070582} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &540070586 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540070582} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1537019967} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: fab06e0be9375cc4d823efa71629885c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &540543599 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DISTORT_ON GLOW_ON WAVEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 7f33f36658f399a44be84455bcd911b1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 2 + - _DistortTexYSpeed: 2 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 4.4 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0.5 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &540549268 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 540549269} + - component: {fileID: 540549273} + - component: {fileID: 540549272} + - component: {fileID: 540549270} + m_Layer: 0 + m_Name: RadialFillAmount + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &540549269 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540549268} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 70, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 718105016} + - {fileID: 1843941480} + m_Father: {fileID: 1351315063} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &540549270 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540549268} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: f325edee1e9fb044eb0d87aad6d3ece0, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &540549272 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540549268} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &540549273 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540549268} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1118634257} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &545525088 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 545525089} + - component: {fileID: 545525091} + - component: {fileID: 545525090} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &545525089 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 545525088} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 597182738} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &545525090 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 545525088} + m_Text: (Gradient Property) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &545525091 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 545525088} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &548255499 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 548255500} + - component: {fileID: 548255504} + - component: {fileID: 548255503} + - component: {fileID: 548255501} + m_Layer: 0 + m_Name: Shine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &548255500 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 548255499} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 280, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 668913776} + - {fileID: 582865293} + m_Father: {fileID: 2036092933} + m_RootOrder: 28 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &548255501 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 548255499} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 1b6613bf9b3fea94380070ae23178552, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &548255503 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 548255499} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &548255504 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 548255499} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2136425119} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &550220620 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 550220621} + - component: {fileID: 550220623} + - component: {fileID: 550220622} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &550220621 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 550220620} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.5699997, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1756331349} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &550220622 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 550220620} + m_Text: (Has Sprite Mask) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &550220623 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 550220620} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &556503703 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 556503704} + - component: {fileID: 556503706} + - component: {fileID: 556503705} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &556503704 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 556503703} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1923390774} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &556503705 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 556503703} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &556503706 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 556503703} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &564363697 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 564363701} + - component: {fileID: 564363700} + - component: {fileID: 564363699} + - component: {fileID: 564363698} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &564363698 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &564363699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &564363700 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 999529079} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: -1 + m_TargetDisplay: 0 +--- !u!224 &564363701 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 356332866} + - {fileID: 1302433542} + - {fileID: 535274222} + - {fileID: 154474731} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &566664013 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 566664014} + - component: {fileID: 566664016} + - component: {fileID: 566664015} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &566664014 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 566664013} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 485976056} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &566664015 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 566664013} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &566664016 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 566664013} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &581202604 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &582549647 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 582549648} + - component: {fileID: 582549650} + - component: {fileID: 582549649} + - component: {fileID: 582549651} + m_Layer: 0 + m_Name: FireBack + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &582549648 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582549647} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.5838726, y: 1.5838726, z: 1.5838726} + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &582549649 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582549647} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &582549650 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582549647} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 1c2c3a51f881cb443906a57116cf56fe, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2ea3ea54c499d314f957e0a47dc11c9c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &582549651 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582549647} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _RotateUvAmount + scrollSpeed: 5 + applyModulo: 1 + modulo: 6.28 + mat: {fileID: 0} +--- !u!1 &582865292 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 582865293} + - component: {fileID: 582865295} + - component: {fileID: 582865294} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &582865293 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582865292} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 548255500} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &582865294 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582865292} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &582865295 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582865292} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &584220653 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 584220654} + - component: {fileID: 584220657} + - component: {fileID: 584220656} + m_Layer: 0 + m_Name: Thermal Vision + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &584220654 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584220653} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 320, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1464450239} + - {fileID: 419511670} + m_Father: {fileID: 1563905016} + m_RootOrder: 32 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &584220656 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584220653} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &584220657 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584220653} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1065071623} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &586081878 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 586081879} + - component: {fileID: 586081881} + - component: {fileID: 586081882} + m_Layer: 0 + m_Name: Greyscale + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &586081879 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 586081878} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 180, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1880243540} + - {fileID: 317082045} + m_Father: {fileID: 2036092933} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &586081881 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 586081878} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 665239746} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &586081882 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 586081878} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &588736391 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 588736392} + - component: {fileID: 588736394} + - component: {fileID: 588736393} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &588736392 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 588736391} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 47460684} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &588736393 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 588736391} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &588736394 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 588736391} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &595151376 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 595151377} + - component: {fileID: 595151378} + m_Layer: 0 + m_Name: Pattern + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &595151377 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595151376} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 120, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5952972451371321220} + - {fileID: 834551331} + - {fileID: 2117073028} + m_Father: {fileID: 1563905016} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &595151378 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595151376} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &595980603 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 595980604} + - component: {fileID: 595980606} + - component: {fileID: 595980605} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &595980604 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595980603} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &595980605 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595980603} + m_Text: Magic Tornado + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &595980606 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595980603} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &597182737 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 597182738} + - component: {fileID: 597182741} + - component: {fileID: 597182740} + m_Layer: 0 + m_Name: Color Ramp Gradient + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &597182738 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597182737} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 140, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 316406008} + - {fileID: 545525089} + m_Father: {fileID: 2036092933} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &597182740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597182737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &597182741 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597182737} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 1c07bf10ccbd5c643b7a3d99b400a745, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &601434482 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 601434483} + - component: {fileID: 601434485} + - component: {fileID: 601434484} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &601434483 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601434482} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1350115731} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &601434484 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601434482} + m_Text: Evil Marine + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &601434485 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601434482} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &605528099 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 605528100} + - component: {fileID: 605528102} + - component: {fileID: 605528101} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &605528100 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 605528099} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 252177636} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &605528101 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 605528099} + m_Text: Gameboy + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &605528102 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 605528099} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &608638372 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 608638373} + - component: {fileID: 608638375} + - component: {fileID: 608638374} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &608638373 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 608638372} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1675838108} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &608638374 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 608638372} + m_Text: Army + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &608638375 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 608638372} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &611714447 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CLIPPING_ON COLORRAMP_ON ETC1_EXTERNAL_ALPHA OFFSETUV_ON OUTBASE8DIR_ON + OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 359431ef2af87794198688f7c632c1e3, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0.04 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0156 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &624559470 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 624559471} + - component: {fileID: 624559473} + - component: {fileID: 624559472} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &624559471 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 624559470} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 984096428} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &624559472 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 624559470} + m_Text: 'Gradient + +' + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &624559473 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 624559470} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &639189023 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON GLOWTEX_ON HITEFFECT_ON OUTBASE8DIR_ON + OUTBASE_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.415 + - _FadeBurnGlow: 15 + - _FadeBurnTransition: 0.105 + - _FadeBurnWidth: 0.026 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 3.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.82 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 0 + - _HitEffectGlow: 10.6 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 9.8 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.011 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: 0 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 0.6053487, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.7193959, b: 0.1273585, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0.9622642, g: 0.10987086, b: 0, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.10969916, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &642204092 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 642204093} + - component: {fileID: 642204094} + - component: {fileID: 642204095} + m_Layer: 0 + m_Name: ScreenHit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &642204093 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642204092} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 200, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 266318148} + - {fileID: 144455308} + - {fileID: 245082891} + m_Father: {fileID: 1563905016} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &642204094 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642204092} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &642204095 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642204092} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 1220612ba20667d46a6e8356073b69b0, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &644371591 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 644371592} + - component: {fileID: 644371594} + - component: {fileID: 644371593} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &644371592 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644371591} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1778749804} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &644371593 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644371591} + m_Text: Hand Drawn + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &644371594 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644371591} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &646019451 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 646019452} + - component: {fileID: 646019454} + - component: {fileID: 646019453} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &646019452 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646019451} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 56751283} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &646019453 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646019451} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &646019454 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646019451} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &653496752 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA MOTIONBLUR_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.345 + - _MotionBlurDist: -1.44 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &665239746 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GREYSCALE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0.097 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &668913775 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 668913776} + - component: {fileID: 668913778} + - component: {fileID: 668913777} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &668913776 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668913775} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 548255500} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &668913777 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668913775} + m_Text: Shine + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &668913778 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668913775} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &671117225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 671117226} + - component: {fileID: 671117230} + - component: {fileID: 671117229} + - component: {fileID: 671117228} + - component: {fileID: 671117227} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &671117226 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + 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: 939106332} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &671117227 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 33212171a9274b947914d32a914af1a3, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &671117228 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &671117229 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &671117230 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 653496752} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &682244416 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 682244417} + - component: {fileID: 682244419} + - component: {fileID: 682244418} + m_Layer: 0 + m_Name: FireFront + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &682244417 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 682244416} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.56, z: -0.05} + m_LocalScale: {x: 0.4067901, y: 0.4067901, z: 0.4067901} + m_Children: [] + m_Father: {fileID: 1953432852} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &682244418 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 682244416} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &682244419 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 682244416} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 327735240} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: bd6f48b4407043345b1a3a07df8c4d61, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &684127072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 684127073} + - component: {fileID: 684127075} + - component: {fileID: 684127074} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &684127073 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684127072} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 353408739} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &684127074 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684127072} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &684127075 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684127072} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &684661038 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 684661039} + - component: {fileID: 684661041} + - component: {fileID: 684661040} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &684661039 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684661038} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 766050008} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &684661040 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684661038} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &684661041 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684661038} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &694591669 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 694591670} + - component: {fileID: 694591673} + - component: {fileID: 694591671} + m_Layer: 0 + m_Name: Minimalist Soldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &694591670 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 694591669} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 300, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1308471598} + - {fileID: 1466512396} + m_Father: {fileID: 1563905016} + m_RootOrder: 30 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &694591671 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 694591669} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &694591673 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 694591669} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 217718272} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &706131456 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 706131457} + - component: {fileID: 706131459} + - component: {fileID: 706131458} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &706131457 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706131456} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 312669278} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &706131458 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706131456} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &706131459 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706131456} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &711155182 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 711155183} + - component: {fileID: 711155184} + m_Layer: 0 + m_Name: Ice + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &711155183 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 711155182} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.0582, y: 0.0425, z: -0.1} + m_LocalScale: {x: 0.67673415, y: 0.7130322, z: 1} + m_Children: [] + m_Father: {fileID: 511167261} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &711155184 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 711155182} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: e4599046180b0ac49b3df99ab01b3e27, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 49cc75da86b2bb949b1235ad2a384f9b, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 1 + m_SpriteSortPoint: 0 +--- !u!1 &712974875 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 712974876} + - component: {fileID: 712974878} + - component: {fileID: 712974877} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &712974876 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712974875} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1329663900} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &712974877 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712974875} + m_Text: (Texture is Tiled) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &712974878 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712974875} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &718105015 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 718105016} + - component: {fileID: 718105018} + - component: {fileID: 718105017} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &718105016 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 718105015} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 540549269} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &718105017 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 718105015} + m_Text: Radial Fill Amount + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &718105018 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 718105015} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &720867419 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 720867420} + - component: {fileID: 720867422} + - component: {fileID: 720867421} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &720867420 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 720867419} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 471382084} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &720867421 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 720867419} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &720867422 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 720867419} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &727703726 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON ETC1_EXTERNAL_ALPHA TEXTURESCROLL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 11.1 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 0.5 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &732186308 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 732186310} + - component: {fileID: 732186309} + m_Layer: 0 + m_Name: Expositors + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &732186309 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 732186308} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b549ed925b49d274c876184f60faabdf, type: 3} + m_Name: + m_EditorClassIdentifier: + expositors: + - {fileID: 2036092934} + - {fileID: 1351315062} + - {fileID: 1563905015} + expositorsTitle: {fileID: 1005972828} + expositorsTitleOutline: {fileID: 535274223} + expositorDistance: -75 + background: {fileID: 356332865} + colorLerpSpeed: 2.5 +--- !u!4 &732186310 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 732186308} + 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: + - {fileID: 2036092933} + - {fileID: 1351315063} + - {fileID: 1563905016} + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &746759202 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 746759203} + - component: {fileID: 746759205} + - component: {fileID: 746759206} + - component: {fileID: 746759207} + m_Layer: 0 + m_Name: Hit Effect + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &746759203 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 150, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 133362206} + - {fileID: 1522371944} + m_Father: {fileID: 2036092933} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &746759205 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 950928387} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &746759206 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &746759207 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: c6e411a605ec50345a36bbab9d3cc722, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &746778957 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 746778958} + - component: {fileID: 746778960} + - component: {fileID: 746778959} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &746778958 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746778957} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 450696184} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &746778959 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746778957} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &746778960 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746778957} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &753155718 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CLIPPING_ON COLORSWAP_ON DISTORT_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON + GLOW_ON GREYSCALEOUTLINE_ON OUTBASE8DIR_ON OUTBASE_ON OUTDIST_ON OUTGREYTEXTURE_ON + OUTTEX_ON PINCH_ON ROUNDWAVEUV_ON ZOOMUV_ON _GLOWTEXUSED_ON _GREYSCALEOUTLINE_ON + _OUTLINE8DIRECTIONS_ON _OUTLINEDISTORTTOGGLE_ON _OUTLINETEXGREY_ON _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.1, y: 0.1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 0.65 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0.179 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0.086 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0.26 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.28 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.2 + - _DistortTexXSpeed: 1 + - _DistortTexYSpeed: 1 + - _EditorDrawers: 6 + - _FadeAmount: 0.461 + - _FadeBurnGlow: 1 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1.8 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 14.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0.27 + - _GreyscaleOutline: 1 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 2 + - _HsvSaturation: 0.92 + - _HsvShift: 151 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 6 + - _InnerOutlineThickness: 1.31 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.67 + - _OutlineDistortTexXSpeed: 0.2 + - _OutlineDistortTexYSpeed: -1 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 15.7 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 1 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 0.5 + - _OutlineTexYSpeed: -3.3 + - _OutlineWidth: 0 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.118 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 0.38 + - _RoundWaveStrength: 0.063 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7.5 + - _WaveSpeed: 9.4 + - _WaveStrength: 22.4 + - _WaveX: 0.106 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.92 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.6687399, g: 1, b: 0.2924528, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.020314153, b: 0, a: 1} + - _ColorSwapRed: {r: 0, g: 0.46226418, b: 0.023657747, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.49019608, g: 0.41710952, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.45882368, g: 1, b: 0, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 0.9811321, g: 0.29619083, b: 0.7939467, a: 1} + - _OutlineColor: {r: 0.3073311, g: 1, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &766050007 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 766050008} + - component: {fileID: 766050012} + - component: {fileID: 766050011} + - component: {fileID: 766050009} + m_Layer: 0 + m_Name: Gradient Scroll + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &766050008 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766050007} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 90, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1675907431} + - {fileID: 684661039} + m_Father: {fileID: 1563905016} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &766050009 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766050007} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: edeeb31731bec5f4092bbc3bbff03e91, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &766050011 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766050007} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &766050012 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766050007} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 946451345} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &772177650 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.437 + - _FadeBurnGlow: 13.5 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &778370415 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 778370416} + - component: {fileID: 778370418} + - component: {fileID: 778370417} + m_Layer: 0 + m_Name: Sprite2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &778370416 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778370415} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.22, y: 0.82, z: -0.05} + m_LocalScale: {x: 1.0080961, y: 1.0080961, z: 1.0080961} + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &778370417 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778370415} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &778370418 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778370415} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2128149943} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &786925990 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 786925991} + - component: {fileID: 786925994} + - component: {fileID: 786925993} + m_Layer: 0 + m_Name: Fish Eye + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &786925991 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 150, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1302959054} + - {fileID: 1039947233} + m_Father: {fileID: 1351315063} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &786925993 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &786925994 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1150284212} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &789390131 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 789390132} + - component: {fileID: 789390134} + - component: {fileID: 789390133} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &789390132 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 789390131} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1350115731} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &789390133 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 789390131} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &789390134 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 789390131} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &793013507 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 793013508} + - component: {fileID: 793013510} + - component: {fileID: 793013509} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &793013508 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793013507} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1119325822} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &793013509 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793013507} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &793013510 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793013507} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &797006599 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 797006600} + - component: {fileID: 797006602} + - component: {fileID: 797006601} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &797006600 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 797006599} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1028271463} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &797006601 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 797006599} + m_Text: Pixelate + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &797006602 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 797006599} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &798161389 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 798161390} + - component: {fileID: 798161392} + - component: {fileID: 798161391} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &798161390 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798161389} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 950130248} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &798161391 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798161389} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &798161392 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798161389} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &798901403 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 798901404} + - component: {fileID: 798901406} + - component: {fileID: 798901405} + m_Layer: 0 + m_Name: Flag + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &798901404 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798901403} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 1.132, y: 0.846, z: 0.1} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 935289136} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &798901405 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798901403} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &798901406 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798901403} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 208665463} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300002, guid: adce45105552071409c959137cb5b670, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 1.76} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &799318215 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 799318216} + - component: {fileID: 799318218} + - component: {fileID: 799318217} + - component: {fileID: 799318219} + m_Layer: 0 + m_Name: FireMid + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &799318216 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 799318215} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: -0.025} + m_LocalScale: {x: 1.0754969, y: 1.0754969, z: 1.0754969} + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} +--- !u!114 &799318217 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 799318215} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &799318218 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 799318215} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 1c2c3a51f881cb443906a57116cf56fe, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2ea3ea54c499d314f957e0a47dc11c9c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &799318219 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 799318215} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _RotateUvAmount + scrollSpeed: 7.5 + applyModulo: 1 + modulo: 6.28 + mat: {fileID: 0} +--- !u!1 &816448198 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 816448199} + - component: {fileID: 816448201} + - component: {fileID: 816448200} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &816448199 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 816448198} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1358020792} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &816448200 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 816448198} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &816448201 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 816448198} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &817315606 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA NEGATIVE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &820886077 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 820886078} + - component: {fileID: 820886080} + - component: {fileID: 820886079} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &820886078 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 820886077} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 420059981} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &820886079 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 820886077} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &820886080 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 820886077} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &822200767 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FLICKER_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0.221 + - _FlickerFreq: 0.31 + - _FlickerPercent: 0.132 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &831340857 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 831340858} + - component: {fileID: 831340861} + - component: {fileID: 831340860} + - component: {fileID: 831340859} + m_Layer: 0 + m_Name: Aura + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &831340858 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831340857} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.05} + m_LocalScale: {x: 1.009596, y: 1.009596, z: 1.009596} + m_Children: [] + m_Father: {fileID: 982048496} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &831340859 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831340857} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &831340860 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831340857} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &831340861 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831340857} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1774397170} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &834551330 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 834551331} + - component: {fileID: 834551333} + - component: {fileID: 834551332} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &834551331 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 834551330} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 595151377} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &834551332 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 834551330} + m_Text: Pattern + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &834551333 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 834551330} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &844328744 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 844328745} + - component: {fileID: 844328747} + - component: {fileID: 844328746} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &844328745 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 844328744} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1447921189} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &844328746 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 844328744} + m_Text: Flicker + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &844328747 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 844328744} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &846281938 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 846281939} + - component: {fileID: 846281941} + - component: {fileID: 846281940} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &846281939 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 846281938} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 419407226} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &846281940 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 846281938} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &846281941 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 846281938} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &849687024 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 849687025} + - component: {fileID: 849687027} + - component: {fileID: 849687026} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &849687025 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 849687024} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 419407226} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &849687026 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 849687024} + m_Text: Textured Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &849687027 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 849687024} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &857099421 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 857099422} + - component: {fileID: 857099424} + - component: {fileID: 857099423} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &857099422 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 857099421} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 972134371} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &857099423 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 857099421} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &857099424 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 857099421} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &858113521 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 858113522} + - component: {fileID: 858113524} + - component: {fileID: 858113523} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &858113522 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858113521} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1813870144} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &858113523 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858113521} + m_Text: Chromatic Aberration + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &858113524 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858113521} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &866812739 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 866812740} + - component: {fileID: 866812742} + - component: {fileID: 866812741} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &866812740 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866812739} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1120052622} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &866812741 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866812739} + m_Text: Glow + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &866812742 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866812739} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &878272796 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 878272797} + - component: {fileID: 878272799} + - component: {fileID: 878272798} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &878272797 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 878272796} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1767383824} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &878272798 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 878272796} + m_Text: Blur + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &878272799 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 878272796} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &883004836 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORSWAP_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON OUTBASE8DIR_ON + OUTBASE_ON OUTDIST_ON OUTTEX_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON _OUTLINEDISTORTTOGGLE_ON + _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: f96aebb9bcd1e3b44bafbb23b1bdac88, type: 3} + m_Scale: {x: 3, y: 3} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1.5, y: 1.5} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.128 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 6.1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.05 + - _OutlineDistortTexXSpeed: 2 + - _OutlineDistortTexYSpeed: -14.6 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 10.4 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 1 + - _OutlineTexYSpeed: -4 + - _OutlineWidth: 0.031 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 8.95 + - _WaveSpeed: 12.14 + - _WaveStrength: 18.77 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.11792451, b: 0.11792451, a: 1} + - _ColorSwapRed: {r: 0.6603774, g: 0.6603774, b: 0.6603774, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.11320752, b: 0.11320752, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.122641504, b: 0.122641504, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &892560182 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 892560183} + - component: {fileID: 892560185} + - component: {fileID: 892560184} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &892560183 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892560182} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1286689243} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &892560184 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892560182} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &892560185 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892560182} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &906963583 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 906963584} + - component: {fileID: 906963586} + - component: {fileID: 906963585} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &906963584 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 906963583} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 982048496} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &906963585 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 906963583} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &906963586 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 906963583} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &912083091 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 912083092} + - component: {fileID: 912083094} + - component: {fileID: 912083093} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &912083092 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 912083091} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1554650441} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &912083093 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 912083091} + m_Text: Wave + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &912083094 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 912083091} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &913568438 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 913568439} + - component: {fileID: 913568441} + - component: {fileID: 913568440} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &913568439 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913568438} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1050471976} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &913568440 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913568438} + m_Text: Fill Amount + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &913568441 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913568438} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &916295327 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CHROMABERR_ON ETC1_EXTERNAL_ALPHA FISHEYE_ON HITEFFECT_ON OUTBASE8DIR_ON + OUTBASE_ON PINCH_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.249 + - _ChromAberrAmount: 0 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 224 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 2 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0107 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.9094448, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &924727830 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 924727831} + - component: {fileID: 924727833} + - component: {fileID: 924727832} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &924727831 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 924727830} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 166039413} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &924727832 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 924727830} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &924727833 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 924727830} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &928177172 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 928177173} + - component: {fileID: 928177175} + - component: {fileID: 928177174} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &928177173 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928177172} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 242385329} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &928177174 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928177172} + m_Text: Water + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &928177175 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928177172} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &933861177 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 933861178} + - component: {fileID: 933861180} + - component: {fileID: 933861179} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &933861178 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933861177} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1554650441} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &933861179 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933861177} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &933861180 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933861177} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &935289135 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 935289136} + - component: {fileID: 935289137} + m_Layer: 0 + m_Name: FlagPole + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &935289136 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935289135} + 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: + - {fileID: 798901404} + m_Father: {fileID: 1883979700} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &935289137 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935289135} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: adce45105552071409c959137cb5b670, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1.26, y: 4.34} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &939106331 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 939106332} + - component: {fileID: 939106333} + m_Layer: 0 + m_Name: MotionBlur + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &939106332 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 939106331} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 210, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 671117226} + - {fileID: 2023359958} + - {fileID: 298142067} + m_Father: {fileID: 2036092933} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &939106333 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 939106331} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &941567972 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 941567973} + - component: {fileID: 941567975} + - component: {fileID: 941567974} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &941567973 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 941567972} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1313138820} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &941567974 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 941567972} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &941567975 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 941567972} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &942262412 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 942262413} + - component: {fileID: 942262415} + - component: {fileID: 942262414} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &942262413 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942262412} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 242385329} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &942262414 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942262412} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &942262415 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942262412} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &944684572 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 944684573} + - component: {fileID: 944684575} + - component: {fileID: 944684576} + - component: {fileID: 944684577} + m_Layer: 0 + m_Name: Posterize + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &944684573 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944684572} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 190, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1357243700} + - {fileID: 1497593394} + m_Father: {fileID: 2036092933} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &944684575 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944684572} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 302907434} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &944684576 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944684572} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &944684577 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944684572} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: e25fb0db751a59a43bb4bd01628feb7e, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &945953420 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 945953421} + - component: {fileID: 945953423} + - component: {fileID: 945953422} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &945953421 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 945953420} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1861014113} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &945953422 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 945953420} + m_Text: (Has Sprite Mask) + m_OffsetZ: -1.5 + m_CharacterSize: 0.06 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &945953423 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 945953420} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &946451345 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA FISHEYE_ON INNEROUTLINE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 2eb26501acf862843a55a2e79af0c3c8, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0.2 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 5.27 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.252 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.1 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 250 + - _InnerOutlineThickness: 3 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1.98 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 0, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 1, b: 1, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 1, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &950130247 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 950130248} + - component: {fileID: 950130250} + m_Layer: 0 + m_Name: Grass + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &950130248 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 950130247} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 150, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 124794631} + - {fileID: 1023365940} + - {fileID: 798161390} + m_Father: {fileID: 1563905016} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &950130250 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 950130247} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &950928387 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA HITEFFECT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 10 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 0.08018869, b: 0.08018869, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &972134370 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 972134371} + - component: {fileID: 972134374} + - component: {fileID: 972134373} + m_Layer: 0 + m_Name: Distortion + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &972134371 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 972134370} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 100, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 305999441} + - {fileID: 857099422} + m_Father: {fileID: 1351315063} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &972134373 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 972134370} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &972134374 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 972134370} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1333622421} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &982048495 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 982048496} + - component: {fileID: 982048499} + - component: {fileID: 982048498} + m_Layer: 0 + m_Name: SuperSaiyan + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &982048496 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 982048495} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 310, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 831340858} + - {fileID: 1432462163} + - {fileID: 906963584} + m_Father: {fileID: 1563905016} + m_RootOrder: 31 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &982048498 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 982048495} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &982048499 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 982048495} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2023436102} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &984096427 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 984096428} + - component: {fileID: 984096430} + - component: {fileID: 984096431} + m_Layer: 0 + m_Name: Gradient + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &984096428 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 80, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 624559471} + - {fileID: 1418206287} + m_Father: {fileID: 2036092933} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &984096430 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 111852238} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &984096431 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &984421900 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA ZOOMUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.09 + - _ColorSwapRedLuminosity: 0.604 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapRed: {r: 0, g: 0.5643088, b: 0.8396226, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &998349593 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 998349594} + - component: {fileID: 998349596} + - component: {fileID: 998349595} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &998349594 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 998349593} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1358020792} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &998349595 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 998349593} + m_Text: Warp + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &998349596 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 998349593} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &999359662 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA SHAKEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &999529076 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 999529080} + - component: {fileID: 999529079} + - component: {fileID: 999529077} + - component: {fileID: 999529081} + - component: {fileID: 999529078} + m_Layer: 4 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &999529077 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fcb2e887baa071545bad04c7b0e87cce, type: 3} + m_Name: + m_EditorClassIdentifier: + targetedItem: {fileID: 4825911116503289154} + demoController: {fileID: 732186309} + speed: 10 +--- !u!114 &999529078 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} + m_Name: + m_EditorClassIdentifier: + sharedProfile: {fileID: 11400000, guid: c12f806a2a3ae954ebb1771c65441e4c, type: 2} + isGlobal: 1 + blendDistance: 0 + weight: 1 + priority: 0 +--- !u!20 &999529079 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + 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_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + 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: 0 + 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 &999529080 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, 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!114 &999529081 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} + m_Name: + m_EditorClassIdentifier: + volumeTrigger: {fileID: 999529080} + volumeLayer: + serializedVersion: 2 + m_Bits: 16 + 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!1 &1005972826 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1005972827} + - component: {fileID: 1005972829} + - component: {fileID: 1005972828} + m_Layer: 5 + m_Name: ExpositorTitle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1005972827 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1005972826} + 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: 535274222} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 9.384888} + m_SizeDelta: {x: 160, y: 121.23} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1005972828 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1005972826} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: d722354f9c8e9e643b5f30f00b5b20ea, type: 3} + m_FontSize: 123 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 123 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Color Effects +--- !u!222 &1005972829 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1005972826} + m_CullTransparentMesh: 0 +--- !u!1 &1022452600 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1022452601} + - component: {fileID: 1022452603} + - component: {fileID: 1022452602} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1022452601 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1022452600} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 47460684} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1022452602 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1022452600} + m_Text: Colors + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1022452603 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1022452600} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1023365939 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1023365940} + - component: {fileID: 1023365942} + - component: {fileID: 1023365941} + m_Layer: 0 + m_Name: GrassSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1023365940 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1023365939} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0.4, z: 0} + m_LocalScale: {x: 0.66693, y: 0.66693, z: 0.66693} + m_Children: [] + m_Father: {fileID: 950130248} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1023365941 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1023365939} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1023365942 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1023365939} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1820263336} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: cf7e1f6ebb800154db2b215cba9330ee, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 10.24, y: 3.06} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1024727761 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOW_ON GRADIENT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 6.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0.054901965, g: 0, b: 0.011764707, a: 1} + - _GradBotRightCol: {r: 0.05660379, g: 0, b: 0.013662981, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1028271462 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1028271463} + - component: {fileID: 1028271465} + - component: {fileID: 1028271466} + m_Layer: 0 + m_Name: Pixelate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1028271463 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1028271462} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 170, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 797006600} + - {fileID: 322195378} + m_Father: {fileID: 2036092933} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1028271465 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1028271462} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1708657337} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1028271466 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1028271462} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1038353158 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1038353159} + - component: {fileID: 1038353162} + - component: {fileID: 1038353161} + - component: {fileID: 1038353163} + m_Layer: 0 + m_Name: Impact + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1038353159 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 70, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1188655027} + - {fileID: 1282385917} + m_Father: {fileID: 1563905016} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1038353161 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1038353162 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 916295327} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &1038353163 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: a1097444efe6cb54f86e2955982c0fe1, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &1039947232 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1039947233} + - component: {fileID: 1039947235} + - component: {fileID: 1039947234} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1039947233 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1039947232} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 786925991} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1039947234 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1039947232} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1039947235 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1039947232} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1041891245 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA TWISTUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 10 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 0.08018869, b: 0.08018869, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1045875747 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORSWAP_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON INNEROUTLINE_ON OUTBASE8DIR_ON + OUTBASE_ON WAVEUV_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.1, y: 0.1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 4abae6e7a5c534a4c8e95edf12a7d0c9, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: -0.01 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.28 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1.44 + - _CullingOption: 0 + - _DistortAmount: 0.2 + - _DistortTexXSpeed: 1 + - _DistortTexYSpeed: 1 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 6 + - _InnerOutlineThickness: 1.31 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 5.1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.096 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 0.38 + - _RoundWaveStrength: 0.063 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7.8 + - _WaveSpeed: 9.4 + - _WaveStrength: 22.4 + - _WaveX: 0.5 + - _WaveY: 0.469 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.92 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.6981132, g: 0.8099337, b: 1, a: 1} + - _ColorSwapGreen: {r: 0.98823535, g: 0.6392157, b: 0.6117647, a: 1} + - _ColorSwapRed: {r: 0.5176471, g: 0.63529414, b: 0.81568635, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.98823535, g: 0.6392157, b: 0.6117647, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 0.9811321, g: 0.29619083, b: 0.7939467, a: 1} + - _OutlineColor: {r: 0.5896226, g: 0.1792453, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1050471975 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1050471976} + - component: {fileID: 1050471980} + - component: {fileID: 1050471979} + - component: {fileID: 1050471977} + m_Layer: 0 + m_Name: Fill Amount + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1050471976 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1050471975} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 60, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 913568439} + - {fileID: 367923811} + m_Father: {fileID: 1351315063} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1050471977 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1050471975} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 6078cf4809fc6174f90700135dcf328f, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1050471979 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1050471975} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1050471980 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1050471975} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 323921624} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1065071623 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON COLORRAMP_ON ETC1_EXTERNAL_ALPHA GLOW_ON NEGATIVE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: -0.238 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1071386687 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1071386688} + - component: {fileID: 1071386690} + - component: {fileID: 1071386689} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1071386688 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1071386687} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1227823621} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1071386689 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1071386687} + m_Text: Shake + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1071386690 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1071386687} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1073566155 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1073566156} + - component: {fileID: 1073566159} + - component: {fileID: 1073566158} + m_Layer: 0 + m_Name: Contrast + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1073566156 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073566155} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 290, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1462418353} + - {fileID: 1267243997} + m_Father: {fileID: 2036092933} + m_RootOrder: 29 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1073566158 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073566155} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1073566159 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073566155} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1693197524} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1073973762 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 50, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1850969167} + - {fileID: 510732448} + m_Father: {fileID: 2036092933} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1073973763 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1073973762} + - component: {fileID: 1073973765} + - component: {fileID: 1073973766} + m_Layer: 0 + m_Name: Outline3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1073973765 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1129192189} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1073973766 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1078024312 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA INNEROUTLINE_ON ONLYINNEROUTLINE_ON OUTBASE8DIR_ON + OUTBASE_ON SHADOW_ON _ONLYINNEROUTLINE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 5 + - _InnerOutlineThickness: 1.6 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 1 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 6.3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.01 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 1 + - _ShadowX: 0 + - _ShadowY: 0 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 0.4811321, b: 0.4811321, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1078196206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1078196207} + - component: {fileID: 1078196209} + - component: {fileID: 1078196208} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1078196207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1078196206} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 511167261} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1078196208 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1078196206} + m_Text: Ice Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1078196209 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1078196206} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1090919392 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1090919393} + - component: {fileID: 1090919395} + - component: {fileID: 1090919394} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1090919393 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090919392} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1986728942} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1090919394 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090919392} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1090919395 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090919392} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1091797525 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1091797526} + - component: {fileID: 1091797528} + - component: {fileID: 1091797527} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1091797526 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1091797525} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1953432852} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1091797527 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1091797525} + m_Text: Fire + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1091797528 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1091797525} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1097188549 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1097188550} + - component: {fileID: 1097188552} + - component: {fileID: 1097188551} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1097188550 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1097188549} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1883979700} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1097188551 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1097188549} + m_Text: Flag + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1097188552 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1097188549} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1100636067 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1100636068} + - component: {fileID: 1100636070} + - component: {fileID: 1100636069} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1100636068 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1100636067} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 166039413} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1100636069 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1100636067} + m_Text: Round Wave + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1100636070 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1100636067} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1103527057 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1103527058} + - component: {fileID: 1103527060} + - component: {fileID: 1103527059} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1103527058 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1103527057} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 2096881075} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1103527059 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1103527057} + m_Text: Shiny Marine + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1103527060 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1103527057} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1105303541 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA SHADOW_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1111461196 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1111461197} + - component: {fileID: 1111461200} + - component: {fileID: 1111461199} + m_Layer: 0 + m_Name: Pinch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1111461197 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111461196} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 160, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 98690189} + - {fileID: 1325646928} + m_Father: {fileID: 1351315063} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1111461199 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111461196} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1111461200 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111461196} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1863638619} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1113550344 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1113550345} + - component: {fileID: 1113550347} + - component: {fileID: 1113550346} + - component: {fileID: 1113550348} + m_Layer: 0 + m_Name: Soldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1113550345 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1113550344} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.549, z: -0.35} + m_LocalScale: {x: 0.62497, y: 0.62497, z: 0.62497} + m_Children: [] + m_Father: {fileID: 2035943844} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1113550346 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1113550344} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1113550347 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1113550344} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 611714447} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &1113550348 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1113550344} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2f06abfb8d5c7014299913ef4dbc450d, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &1117637835 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1117637836} + - component: {fileID: 1117637838} + - component: {fileID: 1117637837} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1117637836 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1117637835} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1528149039} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1117637837 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1117637835} + m_Text: 'Jelly Fish Soldier + +' + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1117637838 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1117637835} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1118634257 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA RADIALCLIPPING_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 0 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1119325821 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1119325822} + - component: {fileID: 1119325826} + - component: {fileID: 1119325825} + - component: {fileID: 1119325823} + m_Layer: 0 + m_Name: Twist + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1119325822 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 120, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1697898091} + - {fileID: 793013508} + m_Father: {fileID: 1351315063} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1119325823 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: ed827ed402dcef3458313b21158b5c7c, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1119325825 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1119325826 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1041891245} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1120052622 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120052623} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 866812740} + - {fileID: 136921169} + m_Father: {fileID: 2036092933} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1120052623 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1120052622} + - component: {fileID: 1120052625} + - component: {fileID: 1120052626} + m_Layer: 0 + m_Name: Glow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1120052625 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120052623} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1319594099} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1120052626 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120052623} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1120672004 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1120672005} + - component: {fileID: 1120672007} + - component: {fileID: 1120672006} + m_Layer: 0 + m_Name: Front + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1120672005 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120672004} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.02} + m_LocalScale: {x: 0.9196, y: 0.65, z: 1} + m_Children: [] + m_Father: {fileID: 540070583} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1120672006 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120672004} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1120672007 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120672004} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2067098021} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: fab06e0be9375cc4d823efa71629885c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1123731222 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1123731223} + - component: {fileID: 1123731226} + - component: {fileID: 1123731225} + m_Layer: 0 + m_Name: Overlay Texture + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1123731223 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1123731222} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 300, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 355247223} + - {fileID: 297942435} + m_Father: {fileID: 2036092933} + m_RootOrder: 30 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1123731225 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1123731222} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1123731226 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1123731222} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1936528753} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1129192189 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON OUTDIST_ON OUTTEX_ON + _OUTLINE8DIRECTIONS_ON _OUTLINEDISTORTTOGGLE_ON _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 806e236bc12668e4da974bb8f536d28f, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.17 + - _OutlineDistortTexXSpeed: 2 + - _OutlineDistortTexYSpeed: -7 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 6.4 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 0 + - _OutlineTexYSpeed: -10 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1146988137 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1146988138} + - component: {fileID: 1146988140} + - component: {fileID: 1146988139} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1146988138 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1146988137} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1988936578} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1146988139 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1146988137} + m_Text: (Texture) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1146988140 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1146988137} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1150284212 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FISHEYE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.338 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1166912798 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CHANGECOLOR_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0.539 + - _ColorChangeTolerance: 0.75 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 0.70980394, g: 0.15686275, b: 0.2901961, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1181865632 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLITCH_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 4 + - _GlitchSize: 1.23 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1183578089 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1183578090} + - component: {fileID: 1183578092} + - component: {fileID: 1183578091} + m_Layer: 0 + m_Name: Outline2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1183578090 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183578089} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.22, y: 0.82, z: 0.05} + m_LocalScale: {x: 1.0080961, y: 1.0080961, z: 1.0080961} + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1183578091 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183578089} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1183578092 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183578089} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 2fff2435ee99439438c463e2ce768283, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1188655026 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1188655027} + - component: {fileID: 1188655029} + - component: {fileID: 1188655028} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1188655027 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188655026} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1038353159} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1188655028 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188655026} + m_Text: Impact + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1188655029 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188655026} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1194409626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1194409627} + - component: {fileID: 1194409629} + - component: {fileID: 1194409628} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1194409627 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194409626} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2045252512} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1194409628 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194409626} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1194409629 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194409626} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1195370958 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DISTORT_ON ETC1_EXTERNAL_ALPHA GLOW_ON GREYSCALE_ON POLARUV_ON + POSTERIZE_ON TEXTURESCROLL_ON WAVEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 4.5} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 1.167 + - _DistortTexXSpeed: 10 + - _DistortTexYSpeed: 10 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 1.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: -0.119 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.7 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 0.94 + - _HsvSaturation: 1.14 + - _HsvShift: 41 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 22 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 9.9 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 0.1 + - _ShakeUvX: 0 + - _ShakeUvY: 5 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 0.17 + - _TextureScrollYSpeed: 1.47 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 18.68 + - _WaveSpeed: 19 + - _WaveStrength: 13.8 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.083333254, g: 1, b: 0, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1201459352 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON CLIPPING_ON CUSTOMBLENDING_ON DISTORT_ON ETC1_EXTERNAL_ALPHA + GLOW_ON WAVEUV_ON WIND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: dd5ae95e1fbf31c4ca76212884f5b8fc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 100 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0.03 + - _ClipUvRight: 0 + - _ClipUvUp: 0.042 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.81 + - _DistortTexXSpeed: -1 + - _DistortTexYSpeed: -5.9 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 14.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 9 + - _GrassWind: 5.8 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 0.4339623, g: 0.08552541, b: 0, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.30916578, b: 0.13207549, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1211354476 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1211354477} + - component: {fileID: 1211354479} + m_Layer: 0 + m_Name: HP Bar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1211354477 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1211354476} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 180, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1697295737} + - {fileID: 1404112919} + - {fileID: 540070583} + m_Father: {fileID: 1563905016} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1211354479 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1211354476} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1213636577 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON ROUNDWAVEUV_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0159 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2.82 + - _RoundWaveStrength: 0.421 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 8.95 + - _WaveSpeed: 12.14 + - _WaveStrength: 18.77 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1227823620 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1227823621} + - component: {fileID: 1227823624} + - component: {fileID: 1227823623} + m_Layer: 0 + m_Name: Shake + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1227823621 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1227823620} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 170, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1071386688} + - {fileID: 1484598037} + m_Father: {fileID: 1351315063} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1227823623 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1227823620} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1227823624 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1227823620} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 999359662} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1229041065 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1229041066} + - component: {fileID: 1229041068} + - component: {fileID: 1229041069} + m_Layer: 0 + m_Name: HueShift + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1229041066 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 110, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 294421776} + - {fileID: 2065278700} + m_Father: {fileID: 2036092933} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1229041068 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2061184730} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1229041069 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1230234141 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA TEXTURESCROLL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.858 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0.84 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1254156827 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1254156828} + - component: {fileID: 1254156830} + - component: {fileID: 1254156829} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1254156828 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1254156827} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1374997139} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1254156829 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1254156827} + m_Text: Double Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1254156830 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1254156827} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1257475202 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1267243996 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1267243997} + - component: {fileID: 1267243999} + - component: {fileID: 1267243998} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1267243997 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1267243996} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1073566156} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1267243998 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1267243996} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1267243999 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1267243996} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1282385916 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1282385917} + - component: {fileID: 1282385919} + - component: {fileID: 1282385918} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1282385917 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1282385916} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1038353159} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1282385918 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1282385916} + m_Text: (Texture is Tiled) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1282385919 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1282385916} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1283967498 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOW_ON GRADIENT_ON HSV_ON OUTBASE8DIR_ON + OUTBASE_ON SHADOW_ON SHINE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0.706 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0.8 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.411 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.009 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.055 + - _ShadowY: 0.054 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 0.5 + - _ShineLocation: 0.481 + - _ShineRotate: 0 + - _ShineWidth: 0.084 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 0.25882354, g: 0.3647059, b: 0.19215688, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1286689242 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1286689243} + - component: {fileID: 1286689245} + - component: {fileID: 1286689246} + m_Layer: 0 + m_Name: Hologram + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1286689243 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1286689242} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 230, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 316897175} + - {fileID: 892560183} + m_Father: {fileID: 2036092933} + m_RootOrder: 23 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1286689245 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1286689242} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 72928926} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1286689246 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1286689242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1302433541 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1302433542} + - component: {fileID: 1302433544} + - component: {fileID: 1302433543} + m_Layer: 5 + m_Name: Splotch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1302433542 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302433541} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.2053999, y: 1.066779, z: 1.148} + m_Children: [] + m_Father: {fileID: 564363701} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 23, y: -40.450073} + m_SizeDelta: {x: 1288.9, y: 199.09998} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &1302433543 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302433541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 51caeab4d98b55046a9013cc2da7e427, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1302433544 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302433541} + m_CullTransparentMesh: 0 +--- !u!1 &1302959053 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1302959054} + - component: {fileID: 1302959056} + - component: {fileID: 1302959055} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1302959054 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302959053} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 786925991} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1302959055 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302959053} + m_Text: Fish Eye + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1302959056 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302959053} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1308471597 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1308471598} + - component: {fileID: 1308471600} + - component: {fileID: 1308471599} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1308471598 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1308471597} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 694591670} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1308471599 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1308471597} + m_Text: Minimalist Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1308471600 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1308471597} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1313138819 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1313138820} + - component: {fileID: 1313138823} + - component: {fileID: 1313138822} + m_Layer: 0 + m_Name: Change 1 Color + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1313138820 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1313138819} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 120, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1641593523} + - {fileID: 941567973} + m_Father: {fileID: 2036092933} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1313138822 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1313138819} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1313138823 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1313138819} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1166912798} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1319594099 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 7.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.58530986, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1325646927 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1325646928} + - component: {fileID: 1325646930} + - component: {fileID: 1325646929} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1325646928 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325646927} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1111461197} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1325646929 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325646927} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1325646930 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325646927} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1328027727 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1328027728} + - component: {fileID: 1328027730} + - component: {fileID: 1328027729} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1328027728 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1328027727} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1767383824} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1328027729 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1328027727} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1328027730 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1328027727} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1329663899 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1329663900} + - component: {fileID: 1329663903} + - component: {fileID: 1329663902} + m_Layer: 0 + m_Name: Poolar Coords + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1329663900 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329663899} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 140, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 487308175} + - {fileID: 712974876} + m_Father: {fileID: 1351315063} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1329663902 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329663899} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1329663903 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329663899} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 87388692} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1333622421 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DISTORT_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.34 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.03 + - _HsvSaturation: 1.262 + - _HsvShift: 251 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1349909629 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON GRADIENT_ON OUTBASE8DIR_ON + OUTBASE_ON SHADOW_ON TWISTUV_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 285a35f6ccf7b1a44b6c198e96105173, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 54b37de4aa07caa4797254cf2351058f, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.933 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 1.58 + - _GlitchSize: 1 + - _Glow: 18.4 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 0.193 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 3 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 3.2 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0134 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.373 + - _ShadowX: 0.11 + - _ShadowY: 0.014 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1.69 + - _TwistUvPosX: 0.555 + - _TwistUvPosY: 0.531 + - _TwistUvRadius: 0.18 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.043704987, g: 1, b: 0, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.36473382, b: 0, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.017440448, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0.3975923, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.5795412, b: 0.1273585, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1350115730 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1350115731} + - component: {fileID: 1350115734} + - component: {fileID: 1350115733} + m_Layer: 0 + m_Name: Evil Marine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1350115731 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 30, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 601434483} + - {fileID: 789390132} + m_Father: {fileID: 1563905016} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1350115733 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1350115734 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 883004836} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1351315061 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1351315063} + - component: {fileID: 1351315062} + - component: {fileID: 1351315064} + m_Layer: 0 + m_Name: 2.UV Effefcts + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1351315062 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1351315061} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6972382efdee4c642812251660f0c4bb, type: 3} + m_Name: + m_EditorClassIdentifier: + radius: 25 + rotateSpeed: 10 +--- !u!4 &1351315063 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1351315061} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -15, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 56751283} + - {fileID: 1778749804} + - {fileID: 361311995} + - {fileID: 1554650441} + - {fileID: 166039413} + - {fileID: 1901854650} + - {fileID: 1050471976} + - {fileID: 540549269} + - {fileID: 443772011} + - {fileID: 1986728942} + - {fileID: 972134371} + - {fileID: 1358020792} + - {fileID: 1119325822} + - {fileID: 2082220742} + - {fileID: 1329663900} + - {fileID: 786925991} + - {fileID: 1111461197} + - {fileID: 1227823621} + m_Father: {fileID: 732186310} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1351315064 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1351315061} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 681095680e77fad40a6dd907b8ba358b, type: 3} + m_Name: + m_EditorClassIdentifier: + paddingX: 10 +--- !u!1 &1355901850 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1355901851} + - component: {fileID: 1355901853} + - component: {fileID: 1355901852} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1355901851 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1355901850} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1434614528} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1355901852 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1355901850} + m_Text: Negative + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1355901853 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1355901850} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1356966096 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1356966097} + - component: {fileID: 1356966099} + - component: {fileID: 1356966098} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1356966097 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1356966096} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4825911116503289154} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1356966098 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1356966096} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1356966099 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1356966096} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1357243699 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1357243700} + - component: {fileID: 1357243702} + - component: {fileID: 1357243701} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1357243700 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1357243699} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 944684573} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1357243701 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1357243699} + m_Text: Posterize + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1357243702 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1357243699} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1358020791 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1358020792} + - component: {fileID: 1358020795} + - component: {fileID: 1358020794} + m_Layer: 0 + m_Name: Warp + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1358020792 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1358020791} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 110, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 998349594} + - {fileID: 816448199} + m_Father: {fileID: 1351315063} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1358020794 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1358020791} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1358020795 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1358020791} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1769422912} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1363957141 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CHROMABERR_ON DOODLE_ON ETC1_EXTERNAL_ALPHA FLICKER_ON GLITCH_ON + GLOW_ON GREYSCALE_ON HOLOGRAM_ON OUTBASE8DIR_ON OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.356 + - _ChromAberrAmount: 0.366 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0.4 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.1 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 6 + - _GlitchSize: 1.22 + - _Glow: 5.2 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 7.08 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 2 + - _HologramMinAlpha: 0.167 + - _HologramStripesAlpha: 0.362 + - _HologramStripesAmount: 0.088 + - _HologramStripesFill: 0.334 + - _HologramStripesLuminosity: 1.26 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.03 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.102 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0, g: 0.09171247, b: 0.6698113, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.4433962, g: 0.4433962, b: 0.4433962, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 0.2841599, b: 0.8490566, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.43268147, b: 0.67058825, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1374997138 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1374997139} + - component: {fileID: 1374997143} + - component: {fileID: 1374997142} + m_Layer: 0 + m_Name: DoubleOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1374997139 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1374997138} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 80, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1254156828} + - {fileID: 298228099} + m_Father: {fileID: 1563905016} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1374997142 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1374997138} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1374997143 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1374997138} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1078024312} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1377307553 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CHROMABERR_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.259 + - _ChromAberrAmount: 0.504 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1399293758 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON TEXTURESCROLL_ON + _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 4, y: 4} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 4.3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.041 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: -1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.5309945, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1402107645 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1402107646} + - component: {fileID: 1402107648} + - component: {fileID: 1402107647} + m_Layer: 0 + m_Name: Sprite1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1402107646 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1402107645} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1.5, y: 0.82, z: 0} + m_LocalScale: {x: 1.0080961, y: 1.0080961, z: 1.0080961} + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1402107647 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1402107645} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1402107648 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1402107645} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 73084414} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 1 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1404112918 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1404112919} + - component: {fileID: 1404112921} + - component: {fileID: 1404112920} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1404112919 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1404112918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1211354477} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1404112920 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1404112918} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1404112921 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1404112918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1415143266 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1415143267} + - component: {fileID: 1415143268} + m_Layer: 0 + m_Name: UnifiedOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1415143267 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1415143266} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 330, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1402107646} + - {fileID: 778370416} + - {fileID: 1521478960} + - {fileID: 1818617670} + - {fileID: 1183578090} + - {fileID: 435111026} + - {fileID: 1924503772} + - {fileID: 1728754561} + m_Father: {fileID: 1563905016} + m_RootOrder: 33 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1415143268 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1415143266} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1418206286 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1418206287} + - component: {fileID: 1418206289} + - component: {fileID: 1418206288} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1418206287 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1418206286} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 984096428} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1418206288 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1418206286} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1418206289 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1418206286} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1432462162 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1432462163} + - component: {fileID: 1432462165} + - component: {fileID: 1432462164} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1432462163 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1432462162} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 982048496} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1432462164 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1432462162} + m_Text: Super Saiyan + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1432462165 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1432462162} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1434614527 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1434614528} + - component: {fileID: 1434614530} + - component: {fileID: 1434614531} + m_Layer: 0 + m_Name: Negative + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1434614528 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 160, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1355901851} + - {fileID: 352221784} + m_Father: {fileID: 2036092933} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1434614530 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 817315606} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1434614531 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1435312052 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1438024879 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1438024880} + - component: {fileID: 1438024882} + - component: {fileID: 1438024881} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1438024880 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1438024879} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 312669278} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1438024881 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1438024879} + m_Text: AlphaOutline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1438024882 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1438024879} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1439702669 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA HSV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 27.6 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.66 + - _HsvShift: 69 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1447921188 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1447921189} + - component: {fileID: 1447921191} + - component: {fileID: 1447921192} + m_Layer: 0 + m_Name: Flicker + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1447921189 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1447921188} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 260, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 844328745} + - {fileID: 1822267181} + m_Father: {fileID: 2036092933} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1447921191 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1447921188} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 822200767} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1447921192 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1447921188} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1450664985 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1450664986} + - component: {fileID: 1450664988} + - component: {fileID: 1450664987} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1450664986 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450664985} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1923390774} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1450664987 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450664985} + m_Text: 'Radial Gradient + +' + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1450664988 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450664985} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1454273601 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1454273602} + - component: {fileID: 1454273604} + - component: {fileID: 1454273603} + - component: {fileID: 1454273605} + m_Layer: 0 + m_Name: FireFront + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1454273602 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1454273601} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0, y: 0, z: -0.05} + m_LocalScale: {x: 0.66255665, y: 0.66255665, z: 0.66255665} + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} +--- !u!114 &1454273603 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1454273601} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1454273604 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1454273601} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 1c2c3a51f881cb443906a57116cf56fe, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2ea3ea54c499d314f957e0a47dc11c9c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1454273605 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1454273601} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _RotateUvAmount + scrollSpeed: 10 + applyModulo: 1 + modulo: 6.28 + mat: {fileID: 0} +--- !u!21 &1459191230 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ATLAS_ON CHANGECOLOR_ON DOODLE_ON ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON + OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0.706 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 6.6 + - _HandDrawnSpeed: 6.13 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 0.49902344 + - _MaxYUV: 0.95703125 + - _MinXUV: 0.068359375 + - _MinYUV: 0.48339844 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.016 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 0.25882354, g: 0.3647059, b: 0.19215688, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1462418352 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1462418353} + - component: {fileID: 1462418355} + - component: {fileID: 1462418354} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1462418353 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1462418352} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1073566156} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1462418354 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1462418352} + m_Text: Contrast + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1462418355 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1462418352} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1464450238 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1464450239} + - component: {fileID: 1464450241} + - component: {fileID: 1464450240} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1464450239 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1464450238} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 584220654} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1464450240 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1464450238} + m_Text: Thermal Vision + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1464450241 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1464450238} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1466512395 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1466512396} + - component: {fileID: 1466512398} + - component: {fileID: 1466512397} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1466512396 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1466512395} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 694591670} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1466512397 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1466512395} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1466512398 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1466512395} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1471800764 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1471800765} + - component: {fileID: 1471800767} + - component: {fileID: 1471800766} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1471800765 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1471800764} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 368348656} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1471800766 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1471800764} + m_Text: Ghost + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1471800767 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1471800764} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1478122370 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1478122371} + - component: {fileID: 1478122374} + - component: {fileID: 1478122373} + m_Layer: 0 + m_Name: OutlineAlwaysVisible + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1478122371 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478122370} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 370, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2134460149} + - {fileID: 326244155} + - {fileID: 1848773095} + - {fileID: 482750999} + m_Father: {fileID: 1563905016} + m_RootOrder: 37 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1478122373 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478122370} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1478122374 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478122370} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1435312052} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1484598036 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1484598037} + - component: {fileID: 1484598039} + - component: {fileID: 1484598038} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1484598037 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1484598036} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1227823621} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1484598038 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1484598036} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1484598039 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1484598036} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1497593393 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1497593394} + - component: {fileID: 1497593396} + - component: {fileID: 1497593395} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1497593394 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1497593393} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 944684573} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1497593395 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1497593393} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1497593396 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1497593393} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1507269761 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1507269762} + - component: {fileID: 1507269766} + - component: {fileID: 1507269765} + - component: {fileID: 1507269763} + m_Layer: 0 + m_Name: Twist Disappear + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1507269762 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 50, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1939573377} + m_Father: {fileID: 1563905016} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1507269763 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: fe198228e3a49df4b966ab214ec9cde5, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1507269765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1507269766 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1912112097} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1510314497 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1510314498} + - component: {fileID: 1510314500} + - component: {fileID: 1510314499} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1510314498 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1510314497} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1687594936} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1510314499 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1510314497} + m_Text: Alpha Cutoff + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1510314500 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1510314497} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1511231069 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1511231070} + - component: {fileID: 1511231072} + - component: {fileID: 1511231071} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1511231070 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1511231069} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 290590332} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1511231071 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1511231069} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1511231072 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1511231069} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1521478959 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1521478960} + - component: {fileID: 1521478962} + - component: {fileID: 1521478961} + m_Layer: 0 + m_Name: Sprite3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1521478960 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1521478959} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.11, y: -0.66, z: -0.1} + m_LocalScale: {x: 1.0657709, y: 1.0657709, z: 1.0657709} + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1521478961 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1521478959} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1521478962 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1521478959} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2007448611} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1522371943 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1522371944} + - component: {fileID: 1522371946} + - component: {fileID: 1522371945} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1522371944 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522371943} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 746759203} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1522371945 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522371943} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1522371946 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522371943} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1523182284 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1523182285} + - component: {fileID: 1523182287} + - component: {fileID: 1523182286} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1523182285 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1523182284} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1861014113} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1523182286 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1523182284} + m_Text: Burning Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1523182287 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1523182284} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1527473306 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1527473307} + - component: {fileID: 1527473309} + - component: {fileID: 1527473308} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1527473307 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1527473306} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 511167261} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1527473308 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1527473306} + m_Text: (Sprite Mask and Particles) + m_OffsetZ: -1.5 + m_CharacterSize: 0.05 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1527473309 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1527473306} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1528149038 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1528149039} + - component: {fileID: 1528149042} + - component: {fileID: 1528149041} + m_Layer: 0 + m_Name: JellyFishSoldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1528149039 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1528149038} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 240, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1117637836} + - {fileID: 1881847164} + m_Father: {fileID: 1563905016} + m_RootOrder: 24 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1528149041 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1528149038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1528149042 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1528149038} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1045875747} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1537019967 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GRADIENT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 14.9 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 0 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.047169805, g: 0.047169805, b: 0.047169805, a: 1} + - _GradBotLeftCol: {r: 0.1792453, g: 0.1792453, b: 0.1792453, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 0, a: 1} + - _GradTopLeftCol: {r: 0.754717, g: 0.754717, b: 0.754717, a: 1} + - _GradTopRightCol: {r: 0.3207547, g: 0.3197579, b: 0.3192417, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1554650440 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1554650441} + - component: {fileID: 1554650444} + - component: {fileID: 1554650443} + m_Layer: 0 + m_Name: Wave + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1554650441 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1554650440} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 30, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 912083092} + - {fileID: 933861178} + m_Father: {fileID: 1351315063} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1554650443 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1554650440} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1554650444 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1554650440} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1984207367} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1562540216 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1562540217} + - component: {fileID: 1562540219} + - component: {fileID: 1562540218} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1562540217 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562540216} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1901854650} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1562540218 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562540216} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1562540219 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562540216} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1563905014 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1563905016} + - component: {fileID: 1563905015} + - component: {fileID: 1563905017} + m_Layer: 0 + m_Name: 3.Effect Combinations + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1563905015 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1563905014} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6972382efdee4c642812251660f0c4bb, type: 3} + m_Name: + m_EditorClassIdentifier: + radius: 45 + rotateSpeed: 10 +--- !u!4 &1563905016 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1563905014} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -30, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1934762264} + - {fileID: 2045252512} + - {fileID: 252177636} + - {fileID: 1350115731} + - {fileID: 1875180451} + - {fileID: 1507269762} + - {fileID: 1675838108} + - {fileID: 1038353159} + - {fileID: 1374997139} + - {fileID: 766050008} + - {fileID: 47460684} + - {fileID: 353408739} + - {fileID: 595151377} + - {fileID: 2035943844} + - {fileID: 1756331349} + - {fileID: 950130248} + - {fileID: 242385329} + - {fileID: 1953432852} + - {fileID: 1211354477} + - {fileID: 1883979700} + - {fileID: 642204093} + - {fileID: 102412577} + - {fileID: 4005302481246734412} + - {fileID: 407134450} + - {fileID: 1528149039} + - {fileID: 42135250} + - {fileID: 357954209} + - {fileID: 499272004} + - {fileID: 2096881075} + - {fileID: 450696184} + - {fileID: 694591670} + - {fileID: 982048496} + - {fileID: 584220654} + - {fileID: 1415143267} + - {fileID: 1861014113} + - {fileID: 511167261} + - {fileID: 1893925001} + - {fileID: 1478122371} + m_Father: {fileID: 732186310} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1563905017 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1563905014} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 681095680e77fad40a6dd907b8ba358b, type: 3} + m_Name: + m_EditorClassIdentifier: + paddingX: 10 +--- !u!1 &1571920278 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1571920279} + - component: {fileID: 1571920281} + - component: {fileID: 1571920280} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1571920279 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1571920278} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4825911116503289154} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1571920280 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1571920278} + m_Text: Original Sprite + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1571920281 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1571920278} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1586363707 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1586363708} + - component: {fileID: 1586363710} + - component: {fileID: 1586363709} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1586363708 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1586363707} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1586363709 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1586363707} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1586363710 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1586363707} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1601051769 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1601051770} + - component: {fileID: 1601051772} + - component: {fileID: 1601051771} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1601051770 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1601051769} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1778749804} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1601051771 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1601051769} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1601051772 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1601051769} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1605957010 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA OFFSETUV_ON OUTBASE8DIR_ON _OUTLINE8DIRECTIONS_ON + _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0137 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!4 &1613686741 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1613686742} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 453652828} + - {fileID: 1706778797} + m_Father: {fileID: 2036092933} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1613686742 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1613686741} + - component: {fileID: 1613686744} + - component: {fileID: 1613686745} + - component: {fileID: 1613686746} + m_Layer: 0 + m_Name: Fade + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1613686744 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1613686742} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 772177650} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1613686745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1613686742} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &1613686746 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1613686742} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2025469cc6b8be543a1b93993e746b75, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &1618143721 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1618143722} + - component: {fileID: 1618143724} + - component: {fileID: 1618143723} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1618143722 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1618143721} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 443772011} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1618143723 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1618143721} + m_Text: Texture Scroll + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1618143724 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1618143721} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1641593522 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1641593523} + - component: {fileID: 1641593525} + - component: {fileID: 1641593524} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1641593523 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1641593522} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1313138820} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1641593524 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1641593522} + m_Text: Change 1 Color + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1641593525 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1641593522} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1673476642 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1673476643} + - component: {fileID: 1673476645} + - component: {fileID: 1673476644} + m_Layer: 0 + m_Name: WaterSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1673476643 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1673476642} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.48, y: 1.48, z: 1.48} + m_Children: [] + m_Father: {fileID: 242385329} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1673476644 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1673476642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1673476645 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1673476642} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2105693144} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: bd3249e8aae01e748aaca0c062e2c19c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1675838107 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1675838108} + - component: {fileID: 1675838112} + - component: {fileID: 1675838111} + m_Layer: 0 + m_Name: Army + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1675838108 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 60, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 608638373} + - {fileID: 489557969} + m_Father: {fileID: 1563905016} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1675838111 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1675838112 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1399293758} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1675907430 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1675907431} + - component: {fileID: 1675907433} + - component: {fileID: 1675907432} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1675907431 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675907430} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 766050008} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1675907432 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675907430} + m_Text: Gradient Scroll + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1675907433 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675907430} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1687594935 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1687594936} + - component: {fileID: 1687594940} + - component: {fileID: 1687594939} + - component: {fileID: 1687594937} + m_Layer: 0 + m_Name: Alpha Cutoff + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1687594936 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1687594935} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 310, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1510314498} + - {fileID: 2088187658} + m_Father: {fileID: 2036092933} + m_RootOrder: 31 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1687594937 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1687594935} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: d7d72c9f17b0ebe4e908dab552b82c45, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1687594939 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1687594935} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1687594940 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1687594935} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 70619476} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1688633193 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1688633194} + - component: {fileID: 1688633196} + - component: {fileID: 1688633195} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1688633194 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1688633193} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.3336719, y: 1.333672, z: 1.3336719} + m_Children: [] + m_Father: {fileID: 166039413} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1688633195 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1688633193} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1688633196 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1688633193} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1213636577} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: bd3249e8aae01e748aaca0c062e2c19c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1693197524 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CONTRAST_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: -0.01 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 6 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1697295736 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1697295737} + - component: {fileID: 1697295739} + - component: {fileID: 1697295738} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1697295737 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697295736} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1211354477} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1697295738 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697295736} + m_Text: HP Bar + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1697295739 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697295736} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1697898090 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1697898091} + - component: {fileID: 1697898093} + - component: {fileID: 1697898092} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1697898091 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697898090} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1119325822} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1697898092 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697898090} + m_Text: Twist + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1697898093 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697898090} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1706778796 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1706778797} + - component: {fileID: 1706778799} + - component: {fileID: 1706778798} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1706778797 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706778796} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1613686741} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1706778798 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706778796} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1706778799 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706778796} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &1708657337 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ALPHACUTOFF_ON ETC1_EXTERNAL_ALPHA PIXELATE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.458 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1723167442 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1723167445} + - component: {fileID: 1723167444} + - component: {fileID: 1723167443} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1723167443 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1723167442} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1723167444 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1723167442} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &1723167445 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1723167442} + 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: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1724918723 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1724918724} + - component: {fileID: 1724918727} + - component: {fileID: 1724918726} + - component: {fileID: 1724918725} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1724918724 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1724918723} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 80, y: 80, z: 1} + m_Children: [] + m_Father: {fileID: 1923390774} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1724918725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1724918723} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1724918726 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1724918723} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1724918727 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1724918723} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 465147594} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 839adabbc5de26041bac66450214a831, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1727216259 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1727216260} + - component: {fileID: 1727216262} + - component: {fileID: 1727216261} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1727216260 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1727216259} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 450696184} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1727216261 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1727216259} + m_Text: Procedural Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1727216262 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1727216259} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1728754560 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1728754561} + - component: {fileID: 1728754563} + - component: {fileID: 1728754562} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1728754561 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1728754560} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1728754562 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1728754560} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1728754563 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1728754560} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1734593091 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1734593092} + - component: {fileID: 1734593093} + m_Layer: 0 + m_Name: Burn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1734593092 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1734593091} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.0582, y: 0.0425, z: -0.1} + m_LocalScale: {x: 0.67673415, y: 0.7130322, z: 1} + m_Children: [] + m_Father: {fileID: 1861014113} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1734593093 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1734593091} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a186aad8f5f9dd04d910c7e3174834c0, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: be304275dbf36014ca9828884588ac47, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 1 + m_SpriteSortPoint: 0 +--- !u!21 &1735095770 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1749643254 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1749643255} + - component: {fileID: 1749643257} + - component: {fileID: 1749643256} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1749643255 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1749643254} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1953432852} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1749643256 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1749643254} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1749643257 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1749643254} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1755864201 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1755864202} + - component: {fileID: 1755864204} + - component: {fileID: 1755864203} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1755864202 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1755864201} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1883979700} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1755864203 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1755864201} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1755864204 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1755864201} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1756331348 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1756331349} + - component: {fileID: 1756331353} + - component: {fileID: 1756331352} + m_Layer: 0 + m_Name: Portal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1756331349 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1756331348} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 140, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1858630623} + - {fileID: 550220621} + - {fileID: 409423831} + m_Father: {fileID: 1563905016} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1756331352 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1756331348} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1756331353 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1756331348} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1195370958} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 1 + m_SpriteSortPoint: 0 +--- !u!1 &1767383823 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1767383824} + - component: {fileID: 1767383826} + - component: {fileID: 1767383827} + - component: {fileID: 1767383828} + m_Layer: 0 + m_Name: Blur + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1767383824 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767383823} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 200, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 878272797} + - {fileID: 1328027728} + m_Father: {fileID: 2036092933} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1767383826 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767383823} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 85408337} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1767383827 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767383823} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &1767383828 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767383823} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 4d13c3a68decb714e80835bb34f348f3, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!21 &1769422912 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA WARP_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.51 + - _WarpSpeed: 10.9 + - _WarpStrength: 0.0211 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1774397170 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON DISTORT_ON ETC1_EXTERNAL_ALPHA FADE_ON HITEFFECT_ON OUTBASE8DIR_ON + _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 100 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.93 + - _DistortTexXSpeed: -1 + - _DistortTexYSpeed: -11.6 + - _EditorDrawers: 6 + - _FadeAmount: 0.29 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 6.8 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 193 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.091 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0, g: 1, b: 0.979686, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1774554235 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: GRADIENT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0.8407619, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0.83921576, b: 1, a: 1} + - _GradTopLeftCol: {r: 0, g: 0.13740095, b: 0.4627451, a: 1} + - _GradTopRightCol: {r: 0, g: 0.14242734, b: 0.46226418, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1778749803 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1778749804} + - component: {fileID: 1778749807} + - component: {fileID: 1778749806} + m_Layer: 0 + m_Name: Hand Drawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1778749804 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778749803} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 644371592} + - {fileID: 1601051770} + m_Father: {fileID: 1351315063} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1778749806 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778749803} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1778749807 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778749803} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 469847421} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1797106725 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1797106726} + - component: {fileID: 1797106728} + - component: {fileID: 1797106727} + m_Layer: 0 + m_Name: FireBack + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1797106726 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1797106725} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.7405772, y: 0.7405772, z: 0.7405772} + m_Children: [] + m_Father: {fileID: 1953432852} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1797106727 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1797106725} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1797106728 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1797106725} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1201459352} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: bd6f48b4407043345b1a3a07df8c4d61, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1809913716 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1809913717} + - component: {fileID: 1809913719} + - component: {fileID: 1809913718} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1809913717 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1809913716} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2035943844} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1809913718 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1809913716} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1809913719 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1809913716} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1813870143 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1813870144} + - component: {fileID: 1813870146} + - component: {fileID: 1813870147} + m_Layer: 0 + m_Name: Chromatic Aberration + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1813870144 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1813870143} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 240, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 858113522} + - {fileID: 376742882} + m_Father: {fileID: 2036092933} + m_RootOrder: 24 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1813870146 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1813870143} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1377307553} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1813870147 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1813870143} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1814697822 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON COLORRAMP_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON HOLOGRAM_ON + HSV_ON PINCH_ON ROTATEUV_ON _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 81687001a52d8024fb3706ba7619ad4b, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 5.1 + - _Brightness: 0 + - _ChromAberrAlpha: 0.461 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: -0.21 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 7.4 + - _GlitchSize: 2.57 + - _Glow: 3.9 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0.651 + - _HologramStripesAmount: 0.124 + - _HologramStripesSpeed: 2.8 + - _HologramUnmodAmount: 0 + - _HsvBright: 1.07 + - _HsvSaturation: 1.86 + - _HsvShift: 360 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 6.28 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1818617669 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1818617670} + - component: {fileID: 1818617672} + - component: {fileID: 1818617671} + m_Layer: 0 + m_Name: Outline1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1818617670 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818617669} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1.5, y: 0.82, z: 0.05} + m_LocalScale: {x: 1.0080961, y: 1.0080961, z: 1.0080961} + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1818617671 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818617669} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1818617672 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818617669} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 2fff2435ee99439438c463e2ce768283, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 1 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1820263336 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CLIPPING_ON ETC1_EXTERNAL_ALPHA WAVEUV_ON WIND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0.35 + - _ClipUvRight: 0.35 + - _ClipUvUp: 0.06 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.02 + - _GrassSpeed: 2 + - _GrassWind: 2 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 5.67 + - _WaveSpeed: 2 + - _WaveStrength: 2.32 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1822267180 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1822267181} + - component: {fileID: 1822267183} + - component: {fileID: 1822267182} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1822267181 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1822267180} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1447921189} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1822267182 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1822267180} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1822267183 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1822267180} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1828174012 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1828174013} + - component: {fileID: 1828174015} + - component: {fileID: 1828174014} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1828174013 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1828174012} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2082220742} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1828174014 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1828174012} + m_Text: Rotate + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1828174015 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1828174012} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1843941479 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1843941480} + - component: {fileID: 1843941482} + - component: {fileID: 1843941481} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1843941480 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843941479} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 540549269} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1843941481 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843941479} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1843941482 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843941479} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1848773094 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1848773095} + - component: {fileID: 1848773097} + - component: {fileID: 1848773096} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1848773095 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1848773094} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1848773096 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1848773094} + m_Text: Outline Always Visible + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1848773097 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1848773094} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1850969166 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1850969167} + - component: {fileID: 1850969169} + - component: {fileID: 1850969168} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1850969167 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1850969166} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1073973762} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1850969168 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1850969166} + m_Text: Distorted Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1850969169 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1850969166} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1858630622 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1858630623} + - component: {fileID: 1858630625} + - component: {fileID: 1858630624} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1858630623 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858630622} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1756331349} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1858630624 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858630622} + m_Text: Portal + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1858630625 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858630622} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1861014112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1861014113} + - component: {fileID: 1861014117} + - component: {fileID: 1861014116} + - component: {fileID: 1861014114} + - component: {fileID: 1861014118} + m_Layer: 0 + m_Name: BurningSoldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1861014113 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 340, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1734593092} + - {fileID: 1523182285} + - {fileID: 945953421} + m_Father: {fileID: 1563905016} + m_RootOrder: 34 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!331 &1861014114 +SpriteMask: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_MaskAlphaCutoff: 0.2 + m_FrontSortingLayerID: 0 + m_BackSortingLayerID: 0 + m_FrontSortingLayer: 0 + m_BackSortingLayer: 0 + m_FrontSortingOrder: 0 + m_BackSortingOrder: 0 + m_IsCustomRangeActive: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1861014116 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1861014117 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cd0693e274874cc4f8ffd67a41ebe801, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &1861014118 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 5f3b82f530c24dd48961a1d428ed91d8, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!21 &1863638619 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA PINCH_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0.097 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.1 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1868383713 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1868383714} + - component: {fileID: 1868383716} + - component: {fileID: 1868383715} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1868383714 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868383713} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1988936578} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1868383715 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868383713} + m_Text: Color Ramp + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1868383716 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868383713} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1869989729 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1869989730} + - component: {fileID: 1869989732} + - component: {fileID: 1869989731} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1869989730 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1869989729} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 357954209} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1869989731 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1869989729} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1869989732 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1869989729} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1875180450 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1875180451} + - component: {fileID: 1875180455} + - component: {fileID: 1875180454} + - component: {fileID: 1875180452} + m_Layer: 0 + m_Name: Teleport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1875180451 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 40, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 520963778} + - {fileID: 152938704} + m_Father: {fileID: 1563905016} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1875180452 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2cd3280111dab4e41ba2dd630db17ca4, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1875180454 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1875180455 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 195375977} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1880243539 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1880243540} + - component: {fileID: 1880243542} + - component: {fileID: 1880243541} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1880243540 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880243539} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 586081879} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1880243541 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880243539} + m_Text: Greyscale + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1880243542 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880243539} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1881847163 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1881847164} + - component: {fileID: 1881847166} + - component: {fileID: 1881847165} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1881847164 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1881847163} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1528149039} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1881847165 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1881847163} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1881847166 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1881847163} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1883979699 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1883979700} + - component: {fileID: 1883979702} + m_Layer: 0 + m_Name: Flag + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1883979700 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1883979699} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 190, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1097188550} + - {fileID: 1755864202} + - {fileID: 935289136} + m_Father: {fileID: 1563905016} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1883979702 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1883979699} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1884970176 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1884970177} + - component: {fileID: 1884970179} + - component: {fileID: 1884970178} + m_Layer: 0 + m_Name: SnowFlakesPS + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1884970177 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1884970176} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.02, z: -0.2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 511167261} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!199 &1884970178 +ParticleSystemRenderer: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1884970176} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: aae53a69b285d6f4aad0e6953245bc7d, type: 2} + - {fileID: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_RenderMode: 0 + m_SortMode: 0 + m_MinParticleSize: 0 + m_MaxParticleSize: 0.5 + m_CameraVelocityScale: 0 + m_VelocityScale: 0 + m_LengthScale: 2 + m_SortingFudge: 0 + m_NormalDirection: 1 + m_ShadowBias: 0 + m_RenderAlignment: 0 + m_Pivot: {x: 0, y: 0, z: 0} + m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 + m_EnableGPUInstancing: 1 + m_ApplyActiveColorSpace: 1 + m_AllowRoll: 1 + m_VertexStreams: 00010304 + m_Mesh: {fileID: 0} + m_Mesh1: {fileID: 0} + m_Mesh2: {fileID: 0} + m_Mesh3: {fileID: 0} + m_MaskInteraction: 0 +--- !u!198 &1884970179 +ParticleSystem: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1884970176} + serializedVersion: 6 + lengthInSec: 1 + simulationSpeed: 1 + stopAction: 0 + cullingMode: 0 + ringBufferMode: 0 + ringBufferLoopRange: {x: 0, y: 1} + looping: 1 + prewarm: 0 + playOnAwake: 1 + useUnscaledTime: 0 + autoRandomSeed: 1 + useRigidbodyForVelocity: 1 + startDelay: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.05 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + moveWithTransform: 0 + moveWithCustomTransform: {fileID: 0} + scalingMode: 1 + randomSeed: 0 + InitialModule: + serializedVersion: 3 + enabled: 1 + startLifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 5 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSpeed: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startColor: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + startSize: + serializedVersion: 2 + minMaxState: 3 + scalar: 0.75 + minScalar: 0.2 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeY: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeZ: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationX: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationY: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotation: + serializedVersion: 2 + minMaxState: 3 + scalar: 6.283185 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + randomizeRotationDirection: 0 + maxNumParticles: 1000 + size3D: 0 + rotation3D: 0 + gravityModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ShapeModule: + serializedVersion: 6 + enabled: 1 + type: 10 + angle: 25 + length: 5 + boxThickness: {x: 0, y: 0, z: 0} + radiusThickness: 1 + donutRadius: 0.2 + m_Position: {x: 0, y: 0, z: 0} + m_Rotation: {x: 0, y: 0, z: 0} + m_Scale: {x: 1, y: 1, z: 1} + placementMode: 0 + m_MeshMaterialIndex: 0 + m_MeshNormalOffset: 0 + m_MeshSpawn: + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Mesh: {fileID: 0} + m_MeshRenderer: {fileID: 0} + m_SkinnedMeshRenderer: {fileID: 0} + m_Sprite: {fileID: 0} + m_SpriteRenderer: {fileID: 0} + m_UseMeshMaterialIndex: 0 + m_UseMeshColors: 1 + alignToDirection: 0 + m_Texture: {fileID: 0} + m_TextureClipChannel: 3 + m_TextureClipThreshold: 0 + m_TextureUVChannel: 0 + m_TextureColorAffectsParticles: 1 + m_TextureAlphaAffectsParticles: 1 + m_TextureBilinearFiltering: 0 + randomDirectionAmount: 0 + sphericalDirectionAmount: 0 + randomPositionAmount: 0 + radius: + value: 1.5 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + arc: + value: 360 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + EmissionModule: + enabled: 1 + serializedVersion: 4 + rateOverTime: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 10 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rateOverDistance: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BurstCount: 1 + m_Bursts: + - serializedVersion: 2 + time: 0 + countCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 15 + minScalar: 30 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + cycleCount: 1 + repeatInterval: 0.01 + probability: 1 + SizeModule: + enabled: 1 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 15.478566 + outSlope: 15.478566 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.061415076 + value: 0.9506173 + inSlope: 0.28985757 + outSlope: 0.28985757 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.24300326 + - serializedVersion: 3 + time: 0.6683 + value: 0.8456783 + inSlope: -1.3612208 + outSlope: -1.3612208 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: -2.5495274 + outSlope: -2.5495274 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + RotationModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + ColorModule: + enabled: 1 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 23708 + atime2: 65535 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 3 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + UVModule: + serializedVersion: 2 + enabled: 0 + mode: 0 + timeMode: 0 + fps: 30 + frameOverTime: + serializedVersion: 2 + minMaxState: 1 + scalar: 0.9999 + minScalar: 0.9999 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startFrame: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedRange: {x: 0, y: 1} + tilesX: 1 + tilesY: 1 + animationType: 0 + rowIndex: 0 + cycles: 1 + uvChannelMask: -1 + rowMode: 1 + sprites: + - sprite: {fileID: 0} + flipU: 0 + flipV: 0 + VelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + radial: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + InheritVelocityModule: + enabled: 0 + m_Mode: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ForceModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + randomizePerFrame: 0 + ExternalForcesModule: + serializedVersion: 2 + enabled: 0 + multiplierCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + influenceFilter: 0 + influenceMask: + serializedVersion: 2 + m_Bits: 4294967295 + influenceList: [] + ClampVelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + magnitude: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxis: 0 + inWorldSpace: 0 + multiplyDragByParticleSize: 1 + multiplyDragByParticleVelocity: 1 + dampen: 0 + drag: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + NoiseModule: + enabled: 0 + strength: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthY: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + frequency: 0.5 + damping: 1 + octaves: 1 + octaveMultiplier: 0.5 + octaveScale: 2 + quality: 2 + scrollSpeed: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remap: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapY: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapZ: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapEnabled: 0 + positionAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rotationAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + sizeAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + SizeBySpeedModule: + enabled: 0 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + range: {x: 0, y: 1} + separateAxes: 0 + RotationBySpeedModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + range: {x: 0, y: 1} + ColorBySpeedModule: + enabled: 0 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + range: {x: 0, y: 1} + CollisionModule: + enabled: 0 + serializedVersion: 3 + type: 0 + collisionMode: 0 + colliderForce: 0 + multiplyColliderForceByParticleSize: 0 + multiplyColliderForceByParticleSpeed: 0 + multiplyColliderForceByCollisionAngle: 1 + plane0: {fileID: 0} + plane1: {fileID: 0} + plane2: {fileID: 0} + plane3: {fileID: 0} + plane4: {fileID: 0} + plane5: {fileID: 0} + m_Dampen: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Bounce: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_EnergyLossOnCollision: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minKillSpeed: 0 + maxKillSpeed: 10000 + radiusScale: 1 + collidesWith: + serializedVersion: 2 + m_Bits: 4294967295 + maxCollisionShapes: 256 + quality: 0 + voxelSize: 0.5 + collisionMessages: 0 + collidesWithDynamic: 1 + interiorCollisions: 0 + TriggerModule: + enabled: 0 + collisionShape0: {fileID: 0} + collisionShape1: {fileID: 0} + collisionShape2: {fileID: 0} + collisionShape3: {fileID: 0} + collisionShape4: {fileID: 0} + collisionShape5: {fileID: 0} + inside: 1 + outside: 0 + enter: 0 + exit: 0 + radiusScale: 1 + SubModule: + serializedVersion: 2 + enabled: 0 + subEmitters: + - serializedVersion: 3 + emitter: {fileID: 0} + type: 0 + properties: 0 + emitProbability: 1 + LightsModule: + enabled: 0 + ratio: 0 + light: {fileID: 0} + randomDistribution: 1 + color: 1 + range: 1 + intensity: 1 + rangeCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + intensityCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + maxLights: 20 + TrailModule: + enabled: 0 + mode: 0 + ratio: 1 + lifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minVertexDistance: 0.2 + textureMode: 0 + ribbonCount: 1 + shadowBias: 0.5 + worldSpace: 0 + dieWithParticles: 1 + sizeAffectsWidth: 1 + sizeAffectsLifetime: 0 + inheritParticleColor: 1 + generateLightingData: 0 + splitSubEmitterRibbons: 0 + attachRibbonsToTransform: 0 + colorOverLifetime: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + widthOverTrail: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorOverTrail: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + CustomDataModule: + enabled: 0 + mode0: 0 + vectorComponentCount0: 4 + color0: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel0: Color + vector0_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_0: X + vector0_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_1: Y + vector0_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_2: Z + vector0_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_3: W + mode1: 0 + vectorComponentCount1: 4 + color1: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel1: Color + vector1_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_0: X + vector1_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_1: Y + vector1_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_2: Z + vector1_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_3: W +--- !u!1 &1888002956 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1888002957} + - component: {fileID: 1888002959} + - component: {fileID: 1888002958} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1888002957 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1888002956} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1934762264} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1888002958 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1888002956} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1888002959 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1888002956} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!4 &1893925001 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + m_PrefabInstance: {fileID: 3864259598862589320} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1901854649 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1901854650} + - component: {fileID: 1901854654} + - component: {fileID: 1901854653} + - component: {fileID: 1901854651} + m_Layer: 0 + m_Name: Offset + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1901854650 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901854649} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 50, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 164406719} + - {fileID: 1562540217} + m_Father: {fileID: 1351315063} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1901854651 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901854649} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 63273b05c4774384b85a146feb6df4d3, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1901854653 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901854649} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1901854654 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901854649} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1605957010} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1912112097 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CLIPPING_ON ETC1_EXTERNAL_ALPHA GLOW_ON HSV_ON PINCH_ON ROTATEUV_ON + TWISTUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0.05 + - _ClipUvLeft: 0.05 + - _ClipUvRight: 0.05 + - _ClipUvUp: 0.05 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.62 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1916465495 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1916465496} + - component: {fileID: 1916465499} + - component: {fileID: 1916465498} + - component: {fileID: 1916465497} + m_Layer: 0 + m_Name: BlurredOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1916465496 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1916465495} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.05} + m_LocalScale: {x: 1.009596, y: 1.009596, z: 1.009596} + m_Children: [] + m_Father: {fileID: 499272004} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1916465497 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1916465495} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1916465498 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1916465495} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1916465499 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1916465495} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 430987701} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1923390773 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1923390774} + - component: {fileID: 1923390776} + m_Layer: 0 + m_Name: RadialGradient + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1923390774 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923390773} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 90, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1724918724} + - {fileID: 1450664986} + - {fileID: 556503704} + m_Father: {fileID: 2036092933} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1923390776 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923390773} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1924503771 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1924503772} + - component: {fileID: 1924503774} + - component: {fileID: 1924503773} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1924503772 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924503771} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1924503773 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924503771} + m_Text: Unified Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1924503774 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924503771} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1931308734 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1931308735} + - component: {fileID: 1931308737} + - component: {fileID: 1931308738} + m_Layer: 0 + m_Name: Color Swap + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1931308735 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 100, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 443722314} + - {fileID: 427761889} + m_Father: {fileID: 2036092933} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1931308737 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 108846146} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1931308738 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1934762263 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1934762264} + - component: {fileID: 1934762267} + - component: {fileID: 1934762266} + - component: {fileID: 1934762268} + m_Layer: 0 + m_Name: Burn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1934762264 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + 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: + - {fileID: 396641006} + - {fileID: 1888002957} + m_Father: {fileID: 1563905016} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1934762266 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1934762267 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 639189023} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &1934762268 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 9d3bba413d0ce9244b743d634f8d3c27, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!21 &1936528753 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA OVERLAY_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 0.413 + - _OverlayGlow: 1.8 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1937897984 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1937897985} + - component: {fileID: 1937897987} + - component: {fileID: 1937897986} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1937897985 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937897984} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2035943844} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1937897986 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937897984} + m_Text: Blurred Back + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1937897987 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937897984} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1939042050 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1939042051} + - component: {fileID: 1939042053} + - component: {fileID: 1939042052} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1939042051 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939042050} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 443772011} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1939042052 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939042050} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1939042053 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939042050} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1939573376 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1939573377} + - component: {fileID: 1939573379} + - component: {fileID: 1939573378} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1939573377 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939573376} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1507269762} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1939573378 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939573376} + m_Text: Twist Disappear + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1939573379 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939573376} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &1949787729 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1949787730} + - component: {fileID: 1949787731} + m_Layer: 0 + m_Name: BackFrame + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1949787730 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1949787729} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.05} + m_LocalScale: {x: 95.922, y: 95.922, z: 95.922} + m_Children: [] + m_Father: {fileID: 242385329} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1949787731 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1949787729} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 839adabbc5de26041bac66450214a831, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1953432851 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1953432852} + - component: {fileID: 1953432853} + m_Layer: 0 + m_Name: Fire + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1953432852 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1953432851} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 170, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1797106726} + - {fileID: 682244417} + - {fileID: 1091797526} + - {fileID: 1749643255} + m_Father: {fileID: 1563905016} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1953432853 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1953432851} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1956560312 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOW_ON GRADIENT_ON RADIALGRADIENT_ON _GRADISRADIAL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 0.741 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 5.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.3 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0.9686275, g: 0.03137255, b: 0.03137255, a: 0} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1984207367 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON WAVEUV_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0159 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 8.95 + - _WaveSpeed: 12.14 + - _WaveStrength: 18.77 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1986728941 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1986728942} + - component: {fileID: 1986728946} + - component: {fileID: 1986728945} + - component: {fileID: 1986728943} + m_Layer: 0 + m_Name: Zoom + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1986728942 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986728941} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 90, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 499438417} + - {fileID: 1090919393} + m_Father: {fileID: 1351315063} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1986728943 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986728941} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: f63147b3bd9ae6949be2ad05c6679dd5, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1986728945 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986728941} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1986728946 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986728941} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 984421900} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1988936577 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1988936578} + - component: {fileID: 1988936580} + - component: {fileID: 1988936581} + m_Layer: 0 + m_Name: Color Ramp + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1988936578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 130, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1868383714} + - {fileID: 1146988138} + m_Father: {fileID: 2036092933} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1988936580 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 581202604} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1988936581 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2004669563 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2004669564} + - component: {fileID: 2004669566} + - component: {fileID: 2004669565} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2004669564 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2004669563} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 252177636} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2004669565 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2004669563} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2004669566 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2004669563} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &2007448611 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA HSV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1.86 + - _HsvShift: 322 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &2008035788 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2008035789} + - component: {fileID: 2008035791} + - component: {fileID: 2008035790} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2008035789 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008035788} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 357954209} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2008035790 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008035788} + m_Text: Twisted Face + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2008035791 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008035788} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &2018750311 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2018750312} + - component: {fileID: 2018750314} + - component: {fileID: 2018750313} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2018750312 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2018750311} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2045252512} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2018750313 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2018750311} + m_Text: Hologram + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2018750314 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2018750311} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &2023359957 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2023359958} + - component: {fileID: 2023359960} + - component: {fileID: 2023359959} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2023359958 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2023359957} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 939106332} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2023359959 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2023359957} + m_Text: Motion Blur + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2023359960 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2023359957} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &2023436102 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORSWAP_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 3d311990b7c2c59478bacea537a60a53, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.163 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 4.1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.66 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 0.6144985, b: 0, a: 1} + - _ColorSwapGreen: {r: 0, g: 0.57254905, b: 1.7176471, a: 1} + - _ColorSwapRed: {r: 1, g: 0.9806782, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.59364164, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &2035943843 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2035943844} + - component: {fileID: 2035943847} + - component: {fileID: 2035943846} + m_Layer: 0 + m_Name: Blurred Back + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2035943844 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2035943843} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 130, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1937897985} + - {fileID: 1809913717} + - {fileID: 1113550345} + m_Father: {fileID: 1563905016} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2035943846 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2035943843} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &2035943847 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2035943843} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 727703726} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 758ac31a9bff9ac4181f54de54a6ecb7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 12.8, y: 6.4} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &2036092932 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2036092933} + - component: {fileID: 2036092934} + - component: {fileID: 2036092935} + m_Layer: 0 + m_Name: 1.Color Effects + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2036092933 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2036092932} + 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: + - {fileID: 4825911116503289154} + - {fileID: 1120052622} + - {fileID: 1613686741} + - {fileID: 290590332} + - {fileID: 419407226} + - {fileID: 1073973762} + - {fileID: 312669278} + - {fileID: 471382084} + - {fileID: 984096428} + - {fileID: 1923390774} + - {fileID: 1931308735} + - {fileID: 1229041066} + - {fileID: 1313138820} + - {fileID: 1988936578} + - {fileID: 597182738} + - {fileID: 746759203} + - {fileID: 1434614528} + - {fileID: 1028271463} + - {fileID: 586081879} + - {fileID: 944684573} + - {fileID: 1767383824} + - {fileID: 939106332} + - {fileID: 368348656} + - {fileID: 1286689243} + - {fileID: 1813870144} + - {fileID: 485976056} + - {fileID: 1447921189} + - {fileID: 420059981} + - {fileID: 548255500} + - {fileID: 1073566156} + - {fileID: 1123731223} + - {fileID: 1687594936} + m_Father: {fileID: 732186310} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2036092934 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2036092932} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6972382efdee4c642812251660f0c4bb, type: 3} + m_Name: + m_EditorClassIdentifier: + radius: 40 + rotateSpeed: 10 +--- !u!114 &2036092935 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2036092932} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 681095680e77fad40a6dd907b8ba358b, type: 3} + m_Name: + m_EditorClassIdentifier: + paddingX: 10 +--- !u!1 &2045252511 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2045252512} + - component: {fileID: 2045252515} + - component: {fileID: 2045252514} + - component: {fileID: 2045252516} + m_Layer: 0 + m_Name: Hologram + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2045252512 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2018750312} + - {fileID: 1194409627} + m_Father: {fileID: 1563905016} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2045252514 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &2045252515 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1363957141} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &2045252516 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: ad5ae64e9a03a1a40889385b2d0f2b89, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!21 &2054684528 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOW_ON HSV_ON OUTBASE8DIR_ON OUTBASE_ON + OUTTEX_ON POLARUV_ON TEXTURESCROLL_ON _OUTLINE8DIRECTIONS_ON _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 3, y: 3} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 1.2 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.465 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0204 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 1.13 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &2061184730 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA HSV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.03 + - _HsvSaturation: 1.262 + - _HsvShift: 251 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &2064997617 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2064997618} + - component: {fileID: 2064997620} + - component: {fileID: 2064997619} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2064997618 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2064997617} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 499272004} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2064997619 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2064997617} + m_Text: Blurred Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2064997620 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2064997617} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &2065278699 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2065278700} + - component: {fileID: 2065278702} + - component: {fileID: 2065278701} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2065278700 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2065278699} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1229041066} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2065278701 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2065278699} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2065278702 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2065278699} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &2066467196 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORSWAP_ON ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.2 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.02 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 0, b: 0, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &2067098021 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CLIPPING_ON ETC1_EXTERNAL_ALPHA GRADIENT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 1 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0.023718417, g: 0.38679248, b: 0.023718417, a: 1} + - _GradBotRightCol: {r: 0.019607844, g: 0.34117648, b: 0.019607844, a: 1} + - _GradTopLeftCol: {r: 0.16907978, g: 1, b: 0, a: 1} + - _GradTopRightCol: {r: 0.16862746, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &2076240280 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ALPHAOUTLINE_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 33.7 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 0.96902657, g: 1, b: 0, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &2076635523 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2076635524} + - component: {fileID: 2076635526} + - component: {fileID: 2076635525} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2076635524 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2076635523} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 361311995} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2076635525 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2076635523} + m_Text: Wind + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2076635526 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2076635523} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &2082220741 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2082220742} + - component: {fileID: 2082220746} + - component: {fileID: 2082220745} + - component: {fileID: 2082220743} + m_Layer: 0 + m_Name: Rotate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2082220742 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082220741} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 130, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1828174013} + - {fileID: 337231025} + m_Father: {fileID: 1351315063} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &2082220743 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082220741} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 1243dd8a666ff6b4787a02084a5170d1, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &2082220745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082220741} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &2082220746 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082220741} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 139334897} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &2088187657 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2088187658} + - component: {fileID: 2088187660} + - component: {fileID: 2088187659} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2088187658 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2088187657} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1687594936} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2088187659 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2088187657} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2088187660 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2088187657} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!1 &2096881074 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2096881075} + - component: {fileID: 2096881080} + - component: {fileID: 2096881079} + - component: {fileID: 2096881076} + m_Layer: 0 + m_Name: ShinyMarine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2096881075 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096881074} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 280, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 1103527058} + - {fileID: 242658910} + m_Father: {fileID: 1563905016} + m_RootOrder: 28 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &2096881076 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096881074} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 8652a2e9bd26fdf45b91d4e790b17cb1, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!212 &2096881079 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096881074} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1283967498} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &2096881080 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096881074} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2099543391 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2099543392} + - component: {fileID: 2099543394} + - component: {fileID: 2099543393} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2099543392 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099543391} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 42135250} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2099543393 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099543391} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2099543394 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099543391} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &2105693144 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DISTORT_ON ETC1_EXTERNAL_ALPHA HSV_ON TEXTURESCROLL_ON WAVEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.25 + - _DistortTexXSpeed: 3 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.24 + - _HsvSaturation: 1.68 + - _HsvShift: 313 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: -0.25 + - _TextureScrollYSpeed: 0.05 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 13.5 + - _WaveSpeed: 12.7 + - _WaveStrength: 13.4 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &2117073027 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2117073028} + - component: {fileID: 2117073030} + - component: {fileID: 2117073029} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2117073028 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2117073027} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 595151377} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2117073029 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2117073027} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2117073030 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2117073027} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!21 &2128149943 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA HSV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 0.74 + - _HsvSaturation: 1.5 + - _HsvShift: 81 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &2134460148 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2134460149} + - component: {fileID: 2134460151} + - component: {fileID: 2134460150} + m_Layer: 0 + m_Name: Outline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2134460149 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2134460148} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.05} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2134460150 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2134460148} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &2134460151 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2134460148} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 453643567} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &2136425119 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA SHINE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 2.15, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 0.8 + - _ShineLocation: 0.49 + - _ShineRotate: 0 + - _ShineWidth: 0.119 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1001 &3864259598862589320 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1563905016} + m_Modifications: + - target: {fileID: 3864259599682641152, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_Name + value: Shield Soldier Demo + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_RootOrder + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalPosition.x + value: 360 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 11bf72cfca6ba93459ddeacea51fd0bd, type: 3} +--- !u!4 &4005302481246734412 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + m_PrefabInstance: {fileID: 6452353472261279598} + m_PrefabAsset: {fileID: 0} +--- !u!4 &4825911116503289154 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 55667222} + 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: + - {fileID: 1571920279} + - {fileID: 1356966097} + m_Father: {fileID: 2036092933} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5952972451371321216 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _HsvShift + scrollSpeed: 0.1 + applyModulo: 1 + modulo: 360 + mat: {fileID: 0} +--- !u!1 &5952972451371321217 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5952972451371321220} + - component: {fileID: 5952972451371321221} + - component: {fileID: 5952972451371321218} + - component: {fileID: 5952972451371321219} + - component: {fileID: 5952972451371321216} + m_Layer: 0 + m_Name: Pattern + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &5952972451371321218 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!95 &5952972451371321219 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: f994ff75b3f33ae46af22e6462b4606a, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!4 &5952972451371321220 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + 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: 595151377} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &5952972451371321221 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1814697822} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2f5c9cbfde2d0384bb53189b0d0f06d8, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 2 + m_Size: {x: 5, y: 5} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1001 &6452353472261279598 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1563905016} + m_Modifications: + - target: {fileID: 7935039278937507617, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_Name + value: Particle System Demo + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_RootOrder + value: 22 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalPosition.x + value: 220 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039279205550812, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 540543599} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 161eac4f3ec2ef344ae473e275658ecf, type: 3} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity.meta new file mode 100644 index 000000000..6ad19d78f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: aa7236836849adb4285d82814f472ea5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity new file mode 100644 index 000000000..c1c7c56fe --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity @@ -0,0 +1,9421 @@ +%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: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + 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, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + 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: 512 + 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 &22377052 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 22377056} + - component: {fileID: 22377055} + - component: {fileID: 22377054} + - component: {fileID: 22377053} + m_Layer: 0 + m_Name: Pinch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &22377053 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 22377052} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &22377054 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 22377052} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &22377055 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 22377052} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 429931735} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &22377056 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 22377052} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -15.4, y: -5.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &56751282 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 56751283} + - component: {fileID: 56751286} + - component: {fileID: 56751285} + - component: {fileID: 56751284} + m_Layer: 0 + m_Name: Watery + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &56751283 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -19.67, y: -5.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &56751284 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &56751285 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &56751286 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1455058978} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &173818797 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON OUTBASE8DIR_ON OUTBASE_ON + TWISTUV_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0.95 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 0.95 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 17.1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 14 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.028 + - _PinchUvAmount: 0.251 + - _PixelateSize: 60 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1.41 + - _TwistUvPosX: 0.558 + - _TwistUvPosY: 0.503 + - _TwistUvRadius: 0.2 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.7877358, b: 0.7877358, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &252177635 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 252177636} + - component: {fileID: 252177639} + - component: {fileID: 252177638} + - component: {fileID: 252177637} + m_Layer: 0 + m_Name: Gameboy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &252177636 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -15.49, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &252177637 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &252177638 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &252177639 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1807806170} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &290590332 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.5100007, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &290590333 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 290590332} + - component: {fileID: 290590335} + - component: {fileID: 290590336} + - component: {fileID: 290590334} + m_Layer: 0 + m_Name: Outline1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &290590334 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &290590335 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1847541096} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &290590336 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &298946310 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 298946312} + - component: {fileID: 298946311} + m_Layer: 0 + m_Name: AutoScroll + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &298946311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298946310} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc188be2d64e8d041aed6f375d92c463, type: 3} + m_Name: + m_EditorClassIdentifier: + totalTime: 12 + sceneDescription: {fileID: 2008890716} +--- !u!4 &298946312 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298946310} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2.7768, y: 2.7768, z: 2.7768} + m_Children: + - {fileID: 252177636} + - {fileID: 786925991} + - {fileID: 984096428} + - {fileID: 520228356} + - {fileID: 1119325822} + - {fileID: 22377056} + - {fileID: 1931308735} + - {fileID: 1073973762} + - {fileID: 1229041066} + - {fileID: 56751283} + - {fileID: 1988936578} + - {fileID: 353408739} + - {fileID: 746759203} + - {fileID: 290590332} + - {fileID: 2045252512} + - {fileID: 1434614528} + - {fileID: 368348656} + - {fileID: 1934762264} + - {fileID: 519649707} + - {fileID: 1350115731} + - {fileID: 1675838108} + - {fileID: 1875180451} + - {fileID: 1507269762} + - {fileID: 1038353159} + - {fileID: 471382084} + - {fileID: 938057646} + - {fileID: 1927382521} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!21 &352855906 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA FISHEYE_ON POSTERIZE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: a9058d3dd9b9dd14cbc6b16db7859653, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &353408738 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 353408739} + - component: {fileID: 353408742} + - component: {fileID: 353408741} + - component: {fileID: 353408740} + m_Layer: 0 + m_Name: Hallucination + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &353408739 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 9.51, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &353408740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &353408741 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &353408742 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 832006925} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &356332865 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 356332866} + - component: {fileID: 356332869} + - component: {fileID: 356332868} + - component: {fileID: 356332867} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &356332866 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + 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: 564363701} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &356332867 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &356332868 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 478667331} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &356332869 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_CullTransparentMesh: 0 +--- !u!1 &368348655 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 368348656} + - component: {fileID: 368348658} + - component: {fileID: 368348659} + - component: {fileID: 368348657} + m_Layer: 0 + m_Name: Ghost + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &368348656 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20.410002, y: -5.1999993, z: 0} + m_LocalScale: {x: 0.78757, y: 0.78757, z: 0.78757} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &368348657 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &368348658 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 426087588} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &368348659 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &423033871 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON OUTBASE8DIR_ON PINCH_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: dbaa905cec0d2b944b5d1ebdbc3ceb1e, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: 0.25 + - _FadeBurnGlow: 1.9 + - _FadeBurnTransition: 0.274 + - _FadeBurnWidth: 0.07 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0141 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 0, g: 0.9400835, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.94117653, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &426087588 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DOODLE_ON ETC1_EXTERNAL_ALPHA FISHEYE_ON GHOST_ON WAVEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.296 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1.41 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &429931735 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA HSV_ON OUTBASE8DIR_ON OUTBASE_ON + OUTTEX_ON PINCH_ON _OUTLINE8DIRECTIONS_ON _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: b3cfc9bf16a1cfa4ab153965dff63ad3, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 1.205 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.12 + - _HsvSaturation: 1.76 + - _HsvShift: 189 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.8 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.03 + - _PinchUvAmount: 0.148 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0, g: 0.80679727, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &471382083 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 471382084} + - component: {fileID: 471382086} + - component: {fileID: 471382087} + - component: {fileID: 471382085} + m_Layer: 0 + m_Name: Inner Outline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &471382084 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.2400002, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 24 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &471382085 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &471382086 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1691765423} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &471382087 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &478667331 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: GRADIENT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 1, g: 0.27058828, b: 0.38275164, a: 1} + - _GradBotRightCol: {r: 0.8392157, g: 0, b: 0.026374353, a: 1} + - _GradTopLeftCol: {r: 0.99806374, g: 1, b: 0.4669811, a: 1} + - _GradTopRightCol: {r: 1, g: 0.66190153, b: 0.25098038, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &519649706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 519649707} + - component: {fileID: 519649710} + - component: {fileID: 519649709} + - component: {fileID: 519649708} + m_Layer: 0 + m_Name: Rotated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &519649707 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519649706} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -10.49, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &519649708 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519649706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &519649709 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519649706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &519649710 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519649706} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 868009891} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &520228355 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 520228356} + - component: {fileID: 520228359} + - component: {fileID: 520228358} + - component: {fileID: 520228357} + m_Layer: 0 + m_Name: Thermal Vision + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &520228356 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520228355} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20.000002, y: 4.8000007, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &520228357 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520228355} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &520228358 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520228355} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &520228359 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520228355} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1713942152} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &564363697 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 564363701} + - component: {fileID: 564363700} + - component: {fileID: 564363699} + - component: {fileID: 564363698} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &564363698 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &564363699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &564363700 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 1239183347} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &564363701 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 356332866} + - {fileID: 2008890717} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!21 &689553382 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DOODLE_ON ETC1_EXTERNAL_ALPHA HSV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.03 + - _HsvSaturation: 1.262 + - _HsvShift: 251 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &694833596 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORSWAP_ON ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON OUTDIST_ON + OUTTEX_ON _OUTLINE8DIRECTIONS_ON _OUTLINEDISTORTTOGGLE_ON _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 806e236bc12668e4da974bb8f536d28f, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.444 + - _ColorSwapGreenLuminosity: 0.255 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.281 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 4 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 0 + - _OutlineTexYSpeed: -10 + - _OutlineWidth: 0.0063 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 0.15566039, b: 0.15566039, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.9654912, b: 0, a: 1} + - _ColorSwapRed: {r: 1, g: 0.40227598, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &707407687 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON OUTBASE8DIR_ON OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: f6a047a86109d084997a9cf4f0a2e5b0, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 0.94 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.1 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: 0.442 + - _FadeBurnGlow: 10.3 + - _FadeBurnTransition: 0.058 + - _FadeBurnWidth: 0.051 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0.4 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 8.47 + - _GlitchSize: 1 + - _Glow: 0.2 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 7.08 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.362 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.334 + - _HologramStripesLuminosity: 1.26 + - _HologramStripesSpeed: 3.19 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 7 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.009 + - _PinchUvAmount: 0.102 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 0.004856825, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.034784317, g: 1, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.4433962, g: 0.4433962, b: 0.4433962, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.5754717, b: 0.09929707, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &746759202 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 746759203} + - component: {fileID: 746759205} + - component: {fileID: 746759206} + - component: {fileID: 746759204} + m_Layer: 0 + m_Name: Hit Effect + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &746759203 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -5.4899993, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &746759204 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &746759205 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2033235221} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &746759206 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &786925990 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 786925991} + - component: {fileID: 786925994} + - component: {fileID: 786925993} + - component: {fileID: 786925992} + m_Layer: 0 + m_Name: Fish Eye + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &786925991 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 15.209999, y: -5.1999993, z: 0} + m_LocalScale: {x: 0.89757, y: 0.89757, z: 0.89757} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &786925992 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &786925993 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &786925994 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 352855906} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &832006925 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOW_ON HSV_ON OUTBASE8DIR_ON OUTBASE_ON OUTTEX_ON + POLARUV_ON TEXTURESCROLL_ON _OUTLINE8DIRECTIONS_ON _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 3, y: 3} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 1.2 + - _GlowTexUsed: 0 + - _GradBlend: 0.465 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0204 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 1.13 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &868009891 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA GLITCH_ON HSV_ON ROTATEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 10.6 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.15 + - _HsvSaturation: 1.33 + - _HsvShift: 114 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 3.14 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &876267714 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON TEXTURESCROLL_ON + _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 4, y: 4} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 4.3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.03 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: -1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.5309945, b: 0, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &938057642 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 938057646} + - component: {fileID: 938057645} + - component: {fileID: 938057644} + - component: {fileID: 938057643} + m_Layer: 0 + m_Name: NegativeGlow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &938057643 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 938057642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &938057644 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 938057642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &938057645 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 938057642} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1809645131} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &938057646 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 938057642} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20.37, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!21 &967204686 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORSWAP_ON ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.09 + - _ColorSwapRedLuminosity: 0.604 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapRed: {r: 0, g: 0.5643088, b: 0.8396226, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &984096427 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 984096428} + - component: {fileID: 984096430} + - component: {fileID: 984096431} + - component: {fileID: 984096429} + m_Layer: 0 + m_Name: Gradient + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &984096428 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.4899993, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &984096429 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &984096430 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1899749361} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &984096431 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1027409867 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DOODLE_ON ETC1_EXTERNAL_ALPHA FISHEYE_ON GLOW_ON GREYSCALE_ON + TWISTUV_ON WAVEUV_ON WIND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 0.95 + - _ClipUvRight: 0.95 + - _ClipUvUp: 0.95 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.061 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 1.5 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: -0.08 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 10 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 0.9780377, b: 0, a: 1} + - _HitEffectColor: {r: 1, g: 0.08018869, b: 0.08018869, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1038353158 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1038353159} + - component: {fileID: 1038353162} + - component: {fileID: 1038353161} + - component: {fileID: 1038353160} + m_Layer: 0 + m_Name: Impact + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1038353159 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -20.269999, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 23 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1038353160 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1038353161 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1038353162 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1450236711} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1072076325 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORSWAP_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON OUTBASE8DIR_ON + OUTBASE_ON OUTDIST_ON OUTTEX_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON _OUTLINEDISTORTTOGGLE_ON + _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: f96aebb9bcd1e3b44bafbb23b1bdac88, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.128 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 6.1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.125 + - _OutlineDistortTexXSpeed: 0 + - _OutlineDistortTexYSpeed: -4 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 11 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 1 + - _OutlineTexYSpeed: -5 + - _OutlineWidth: 0.0172 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 8.95 + - _WaveSpeed: 12.14 + - _WaveStrength: 18.77 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.11792451, b: 0.11792451, a: 1} + - _ColorSwapRed: {r: 0.6603774, g: 0.6603774, b: 0.6603774, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.990566, g: 0.1448469, b: 0.1448469, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!4 &1073973762 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.5100007, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1073973763 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1073973762} + - component: {fileID: 1073973765} + - component: {fileID: 1073973766} + - component: {fileID: 1073973764} + m_Layer: 0 + m_Name: Outline3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1073973764 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1073973765 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 694833596} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1073973766 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1119325821 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1119325822} + - component: {fileID: 1119325826} + - component: {fileID: 1119325825} + - component: {fileID: 1119325824} + m_Layer: 0 + m_Name: Twist + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1119325822 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 15.269999, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1119325824 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1119325825 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1119325826 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1027409867} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1229041065 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1229041066} + - component: {fileID: 1229041068} + - component: {fileID: 1229041069} + - component: {fileID: 1229041067} + m_Layer: 0 + m_Name: HueShift + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1229041066 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -15.49, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1229041067 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1229041068 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 689553382} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1229041069 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1239183345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1239183348} + - component: {fileID: 1239183347} + - component: {fileID: 1239183346} + - component: {fileID: 1239183350} + - component: {fileID: 1239183349} + m_Layer: 4 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1239183346 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_Enabled: 1 +--- !u!20 &1239183347 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.2924528, g: 0.2924528, b: 0.2924528, 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: 125 + 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 &1239183348 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -20} + 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!114 &1239183349 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} + m_Name: + m_EditorClassIdentifier: + sharedProfile: {fileID: 11400000, guid: c12f806a2a3ae954ebb1771c65441e4c, type: 2} + isGlobal: 1 + blendDistance: 0 + weight: 1 + priority: 0 +--- !u!114 &1239183350 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} + m_Name: + m_EditorClassIdentifier: + volumeTrigger: {fileID: 1239183348} + volumeLayer: + serializedVersion: 2 + m_Bits: 16 + stopNaNPropagation: 1 + finalBlitToCameraTarget: 1 + 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!1 &1350115730 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1350115731} + - component: {fileID: 1350115734} + - component: {fileID: 1350115733} + - component: {fileID: 1350115732} + m_Layer: 0 + m_Name: Evil Marine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1350115731 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -10.49, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1350115732 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1350115733 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1350115734 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1072076325} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1433877713 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CHROMABERR_ON DOODLE_ON ETC1_EXTERNAL_ALPHA FLICKER_ON GLITCH_ON + GLOW_ON GREYSCALE_ON HOLOGRAM_ON OUTBASE8DIR_ON OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 0 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0.4 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 8.47 + - _GlitchSize: 1 + - _Glow: 5.2 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 7.08 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1.4 + - _HologramMinAlpha: 0.43 + - _HologramStripesAlpha: 0.362 + - _HologramStripesAmount: 0.071 + - _HologramStripesFill: 0.334 + - _HologramStripesLuminosity: 1.26 + - _HologramStripesSpeed: 3.19 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.035 + - _PinchUvAmount: 0.102 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0, g: 0.09171247, b: 0.6698113, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.4433962, g: 0.4433962, b: 0.4433962, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 0.67701864, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.43268147, b: 0.67058825, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1434614527 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1434614528} + - component: {fileID: 1434614530} + - component: {fileID: 1434614531} + - component: {fileID: 1434614529} + m_Layer: 0 + m_Name: Negative + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1434614528 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.4899993, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1434614529 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1434614530 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1889875392} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1434614531 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1450236711 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: CHROMABERR_ON ETC1_EXTERNAL_ALPHA FISHEYE_ON HITEFFECT_ON OUTBASE8DIR_ON + OUTBASE_ON PINCH_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.249 + - _ChromAberrAmount: 0.563 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 0 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 224 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 2 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.021 + - _PinchUvAmount: 0.075 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.9094448, b: 0, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1455058978 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: DISTORT_ON ETC1_EXTERNAL_ALPHA FLICKER_ON GREYSCALE_ON HOLOGRAM_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.4 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 2.24 + - _HologramMinAlpha: 0.284 + - _HologramStripesAlpha: 0.815 + - _HologramStripesAmount: 0.087 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 0.62 + - _HologramStripesSpeed: 4.26 + - _HologramUnmodAmount: 0.061 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0, g: 0.80679727, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 0.88246155, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1507269761 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1507269762} + - component: {fileID: 1507269766} + - component: {fileID: 1507269765} + - component: {fileID: 1507269764} + m_Layer: 0 + m_Name: TwistFace + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1507269762 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.5999999, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 22 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1507269764 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1507269765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1507269766 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 173818797} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1675838107 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1675838108} + - component: {fileID: 1675838112} + - component: {fileID: 1675838111} + - component: {fileID: 1675838110} + m_Layer: 0 + m_Name: Army + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1675838108 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 9.359999, y: 4.8000007, z: 0} + m_LocalScale: {x: 0.88, y: 0.88, z: 0.88} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1675838110 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1675838111 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1675838112 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 876267714} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1691765423 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA INNEROUTLINE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 6.9 + - _InnerOutlineThickness: 3 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0.2028302, b: 0.9452239, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1713942152 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON COLORRAMP_ON ETC1_EXTERNAL_ALPHA GLOW_ON NEGATIVE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: -0.238 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0.5 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1789615841 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON RADIALGRADIENT_ON + _GRADISRADIAL_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 0 + - _GradBoostX: 0.77 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 15 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.035 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1807806170 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA GLOWTEX_ON OUTBASE8DIR_ON OUTBASE_ON + PIXELATE_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 285a35f6ccf7b1a44b6c198e96105173, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.975 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.75 + - _ColorSwapGreenLuminosity: 0.264 + - _ColorSwapRedLuminosity: 0.75 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: 0.437 + - _FadeBurnGlow: 6.6 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 2.5 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 6.9 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0539 + - _PinchUvAmount: 0.35 + - _PixelateSize: 40 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 1.61 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.41037738, g: 0.5180799, b: 1, a: 1} + - _ColorSwapGreen: {r: 0, g: 1, b: 0.96124196, a: 1} + - _ColorSwapRed: {r: 0.9528302, g: 0.783215, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1809645131 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON GREYSCALE_ON OUTBASE8DIR_ON + OUTBASE_ON _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 5.6 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.008 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.13536787, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1847541096 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON ETC1_EXTERNAL_ALPHA GREYSCALE_ON OUTBASE8DIR_ON WIND_ON + _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 8 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0159 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0, g: 0.745283, b: 0.044833504, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1875180450 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1875180451} + - component: {fileID: 1875180455} + - component: {fileID: 1875180454} + - component: {fileID: 1875180453} + m_Layer: 0 + m_Name: Teleport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1875180451 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -5.4899993, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1875180453 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1875180454 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1875180455 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 423033871} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1889875392 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA NEGATIVE_ON SHAKEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 1.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!21 &1899749361 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GRADIENT_ON SHADOW_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 0.858 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.155 + - _ShadowY: -0.081 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1927382520 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1927382521} + - component: {fileID: 1927382525} + - component: {fileID: 1927382524} + - component: {fileID: 1927382523} + m_Layer: 0 + m_Name: Toxic + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1927382521 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1927382520} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 9.689999, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1927382523 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1927382520} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1927382524 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1927382520} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1927382525 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1927382520} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 707407687} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1931308734 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1931308735} + - component: {fileID: 1931308737} + - component: {fileID: 1931308738} + - component: {fileID: 1931308736} + m_Layer: 0 + m_Name: Color Swap + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1931308735 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -20.49, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1931308736 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1931308737 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 967204686} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1931308738 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1934762263 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1934762264} + - component: {fileID: 1934762267} + - component: {fileID: 1934762266} + - component: {fileID: 1934762265} + m_Layer: 0 + m_Name: Burn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1934762264 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -5.7000003, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1934762265 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 4 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1934762266 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1934762267 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2144125442} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1988936577 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1988936578} + - component: {fileID: 1988936580} + - component: {fileID: 1988936581} + - component: {fileID: 1988936579} + m_Layer: 0 + m_Name: Color Ramp + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1988936578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -10.49, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1988936579 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1988936580 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1789615841} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1988936581 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2008890716 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2008890717} + - component: {fileID: 2008890719} + - component: {fileID: 2008890718} + m_Layer: 5 + m_Name: SceneDescription + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2008890717 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008890716} + 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: 564363701} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -400} + m_SizeDelta: {x: 1433.1, y: 111.5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2008890718 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008890716} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_FontSize: 98 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 225 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Effects will automatically scroll when in playmode +--- !u!222 &2008890719 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008890716} + m_CullTransparentMesh: 0 +--- !u!21 &2033235221 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA HITEFFECT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 0.379 + - _HitEffectGlow: 11 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0, g: 0.7054799, b: 0.8207547, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &2045252511 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2045252512} + - component: {fileID: 2045252515} + - component: {fileID: 2045252514} + - component: {fileID: 2045252513} + m_Layer: 0 + m_Name: Hologram + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2045252512 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 14.51, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2045252513 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrenght: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &2045252514 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &2045252515 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1433877713} + 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: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &2144125442 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON GLOWTEX_ON HITEFFECT_ON _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: 0.415 + - _FadeBurnGlow: 15 + - _FadeBurnTransition: 0.105 + - _FadeBurnWidth: 0.026 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 3.3 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.82 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 0 + - _HitEffectGlow: 10.6 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: 0 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 0.6053487, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.7193959, b: 0.1273585, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0.9622642, g: 0.10987086, b: 0, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity.meta new file mode 100644 index 000000000..1844a0553 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 63119d9cc000fdf4b96768c82b7d49b3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity new file mode 100644 index 000000000..198575be5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity @@ -0,0 +1,1234 @@ +%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: 1 + m_FogColor: {r: 0.35287845, g: 0.39309406, b: 0.5019608, a: 1} + m_FogMode: 3 + m_FogDensity: 0.03 + 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: 10304, guid: 0000000000000000f000000000000000, type: 0} + 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, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 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: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + 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 &297631556 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 297631557} + - component: {fileID: 297631558} + m_Layer: 0 + m_Name: PointLights + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &297631557 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297631556} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.04} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 309637868} + - {fileID: 1340967441} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &297631558 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297631556} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f2560c72fbbcfe44195e240286d1d4e5, type: 3} + m_Name: + m_EditorClassIdentifier: + rotationSpeed: 45 + rotationAxis: {x: 0, y: 1, z: 0} + useLocalRotation: 0 +--- !u!1 &309637867 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 309637868} + - component: {fileID: 309637869} + m_Layer: 0 + m_Name: Point Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &309637868 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 309637867} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 2.32, z: -5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 297631557} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!108 &309637869 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 309637867} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 2 + m_Shape: 0 + m_Color: {r: 0, g: 1, b: 0.07846761, a: 1} + m_Intensity: 10 + m_Range: 7.89 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + 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_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!1 &831620395 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 831620397} + - component: {fileID: 831620396} + 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 &831620396 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831620395} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + 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_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &831620397 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831620395} + m_LocalRotation: {x: 0.17450753, y: 0, z: 0, w: 0.98465586} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 20.1, y: 0, z: 0} +--- !u!1 &1331354938 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1331354939} + - component: {fileID: 1331354942} + - component: {fileID: 1331354941} + - component: {fileID: 1331354940} + m_Layer: 0 + m_Name: 2DSprite-Transparent + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1331354939 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 29.32, y: 1.21, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4467823508785041245} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1331354940 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 5 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!95 &1331354941 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2025469cc6b8be543a1b93993e746b75, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!212 &1331354942 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 2d686b7701c352240a308c7b5da3d710, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 0.43137255} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1340967440 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1340967441} + - component: {fileID: 1340967442} + m_Layer: 0 + m_Name: Point Light (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1340967441 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1340967440} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 2.32, z: 5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 297631557} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!108 &1340967442 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1340967440} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 2 + m_Shape: 0 + m_Color: {r: 1, g: 0, b: 0.0951767, a: 1} + m_Intensity: 10 + m_Range: 7.89 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + 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_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!1 &1376930971 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1376930974} + - component: {fileID: 1376930973} + - component: {fileID: 1376930972} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1376930972 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1376930971} + m_Enabled: 1 +--- !u!20 &1376930973 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1376930971} + 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_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + 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: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1376930974 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1376930971} + m_LocalRotation: {x: 0.27899113, y: 0, z: 0, w: 0.9602937} + m_LocalPosition: {x: 0, y: 8.36, z: -11.08} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 32.4, y: 0, z: 0} +--- !u!1 &4467823508200106856 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4467823508200106859} + - component: {fileID: 4467823508200106858} + - component: {fileID: 4467823508200106860} + - component: {fileID: 4467823508200106857} + m_Layer: 0 + m_Name: 2DSprite1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &4467823508200106857 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 5 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &4467823508200106858 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a6fac1ae6d53b7245ad918865e14c52e, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &4467823508200106859 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 1.15, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4467823508785041245} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &4467823508200106860 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: ed827ed402dcef3458313b21158b5c7c, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &4467823508418042096 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4467823508418042098} + - component: {fileID: 4467823508418042097} + - component: {fileID: 4467823508418042099} + - component: {fileID: 4467823508418042100} + m_Layer: 0 + m_Name: 2DSprite3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &4467823508418042097 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 23a4e6f17bbaf66479862eb488f28181, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &4467823508418042098 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 6.6, y: 1.21, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4467823508785041245} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &4467823508418042099 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2025469cc6b8be543a1b93993e746b75, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &4467823508418042100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 5 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!1 &4467823508785041244 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4467823508785041245} + m_Layer: 0 + m_Name: LitSprites + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4467823508785041245 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508785041244} + 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: + - {fileID: 4467823508200106859} + - {fileID: 4467823509716073570} + - {fileID: 4467823508418042098} + - {fileID: 1331354939} + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &4467823509716073568 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4467823509716073570} + - component: {fileID: 4467823509716073569} + - component: {fileID: 4467823509716073571} + m_Layer: 0 + m_Name: 2DSprite2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &4467823509716073569 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823509716073568} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: c597a6bd515e47a429c79f272eb6762a, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &4467823509716073570 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823509716073568} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -6.6, y: 1.33, z: 0} + m_LocalScale: {x: 1.8061016, y: 1.8061016, z: 1.8061016} + m_Children: [] + m_Father: {fileID: 4467823508785041245} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4467823509716073571 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823509716073568} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 5 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!1 &6574949516878858562 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6574949516878858574} + - component: {fileID: 6574949516878858575} + - component: {fileID: 6574949516878858572} + - component: {fileID: 6574949516878858573} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &6574949516878858572 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949516878858562} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: f967997c8b2ff004ebed845351a5449c, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!65 &6574949516878858573 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949516878858562} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!4 &6574949516878858574 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949516878858562} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -1, z: 0} + m_LocalScale: {x: 100, y: 1, z: 100} + m_Children: [] + m_Father: {fileID: 6574949518432501818} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &6574949516878858575 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949516878858562} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &6574949517728517880 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949517728517884} + m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: -1, z: 27.9} + m_LocalScale: {x: 100, y: 1, z: 100} + m_Children: [] + m_Father: {fileID: 6574949518432501818} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!33 &6574949517728517881 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949517728517884} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &6574949517728517884 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6574949517728517880} + - component: {fileID: 6574949517728517881} + - component: {fileID: 6574949517728517886} + - component: {fileID: 6574949517728517887} + m_Layer: 0 + m_Name: Wall + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &6574949517728517886 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949517728517884} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 38bc0196d341b5b4a9998eff3a9112b9, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!65 &6574949517728517887 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949517728517884} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!4 &6574949518432501818 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949518432501819} + 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: + - {fileID: 6574949516878858574} + - {fileID: 6574949517728517880} + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6574949518432501819 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6574949518432501818} + m_Layer: 0 + m_Name: Environment + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity.meta new file mode 100644 index 000000000..b2717582f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 86d599b29c3c772489a054510b3caf0c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts.meta new file mode 100644 index 000000000..2f4081d02 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2e2455655940ed4ca1596166ba120ca +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf new file mode 100644 index 0000000000000000000000000000000000000000..852f4546dac0124deb60b1ff2f273cc13ed34eb1 GIT binary patch literal 59284 zcmcfq2S8NE_6Ls7%)MLayTGz^c3Fywps*Av0wN+{FA!Ob6|pNujj>=28a2k47!r-K z#gu1EVoZIBNlcz4y=$Urw)Dhjx(a*weP-@1EGWs#_y7O>)a$)>?vyiU&YW}RoHMh8 z5<+~*aw3t!AtQRE4Xu0YV?t;tQpZi4Ilk`UfyWLL;{6;Ua`fc!bL&V1(G&8`&G>GZ zJY!*P=D?OlLV{`t+4KNIRyy;I`31cPsV%Pl$rBxqLts=g7=3B z@iI)Gbi=G4di_yC$Wx(&L`2V+J#qXU181xx#Qzhtw{GV6o9ftf_7U=TL3zup@iQlN z%lXAf$h*A=(Os;YJ$Ig_kls$n$M|ljBD^meLY(&uJTW#P?|0&(M*<;7?mD)G-{1Yu zw#`bNvR41H?l@k(M1KAO<#fjt!0k)$-BlgkNe^@b3Va04Ui6H|C?~Ugli7+C` z(*TKv=rvn4c2pUm-lg|REeq7k%tvO7$xI{fB<%5_g#6&Hpmd z(*+hncML&`(g|%L@>u|15=|nn0fxisMIR&etbo*O=aYKrS5hM%AwxBxWB?tB^p{Bu zza$G;E{BtPx|n!NrMNFa`o}Hr$Y;qw`78^@{chLwDDLxdmEqcgYdU}CZP3rj2u(lK zk9zoBI!Kmj9eDO3X>vExsLdty^5djYwv$HbUA&`xc`0c`*}YN~p39K_4ALJVjhYzJ zsH;I*pSHUkNYbQlNty;}yiV;c`2H&1@vP}V8d*>D2Qc%yv_-%X#^xjMP{1$*?QS6s z{><;p2hY5Hn`pnD9wVtz7M@ol|5)TjeX@c)nRw3vF0KP?v1BgWP8{+8eCvWXkx!aT z21q~Q`WDX}2$MuayMp+lWInF&V!14iq7dYp5cVB2ru0fr7_P@r$=$!NS0x) zY9)UEnUuKh%f$T`QYUe)`7f|Dj3LKk$2-zY?ldu{fZL9D{h!34AA-JPd^xSlz0ua2 zB+T_*DCQpMzq31^mwaxB`%)6;e&_VU$L)W;^Eu7u6(7siu|=Qw{Ni)m^G=^2OX$lj zugd>zX_5aRBRRcunsfI}N+JuzwFu?v$lDb2hh3o(jldkrMw$cj{b^Dm#gQdwZw)n( zd`&K?(5yyUBB{_fkP7VrQlYCS6?AvY3mhiS$E1;DnS8qC3r;5-CO+QUKS&9kP1bQ9 zreTD*d6@h;$rkXuNTzXI%1@98jvHQ=_6ixo`Ij!1)M~SdgU)U_#?v)6QY}@GTIo4b zOLu{PaQq=n){$Glzmw%3$uRMKDVf9b$StHA`SwVC@%{?Qmd=tT(thx>Ur~n7qYI>1 z{+3LED4L@gK(3b!pi5pS!T0_oTa$?PB{GEWYB?k37%zkGJdO8JJBbu?TGM_`X7Tao z^a>jNhSRG4HIl8*Cv&tDNv`Po4`i|2)bgR+L}~@TZX15N z*+`#5jQS_Z5cWQ_jWp!n2N~KQc@~l-7}HqIL%{u?NPmqC(>{ym)xaIvl71#;(Kgb# z`~dFw{Qic^8^E5c{Rr(Nj~F`+3;3FhwxuV@GIktzbl9s2z ztHWq0#;5h7xxvhHDE*%Pmx5Xm+VMM^BbY>!e$yUD7-95P7V;DY_y0SBuFKZHcucSbAFQmK;l-CErqPS!UT|dC0QQ zs2g-r2Azm50h_?ULO66CCFm7SVYTdmh9G+?{C-g?X4{v z(Q=rp<#Dk!Hp_+AFT8!>deVAAD#K|%m-)QK6B@px-+xROgj^JhMoTN z^lzuvpI&&{aysg?>2&ay&4irx{!;n!?3ZtT`TCauK~sVz2aOHP)#VG^--uq%!}b5h zpXg32m571d$P$T`dGkC_obj*S9|{d!{o}s3`|R13%(V z0??9?1d<>UOiUz%m`Nz+RXA2fktB*lV|8F5RuW5WB#y+B1d>R)kglW~Ng~}zGD#sl zNKcYV(ukd;lMIqcvOu5NB!}dZJkp!wlLF9eA5uj6l48=2l#u?Ul$4QjG61WNL1Zu) zLWYuIWH=c?Mv@9rNvff-Yh38$STr6Hjq2WJ>)*Jjcf-k z?f^C3PaYt9$b;k|@-Ol**(+wo$~Xl^qcj6 zcm;Y5^;+t+&+DkyXWqWvao%a(mEJdauk_yS{k-=@pAesQKF|3mzJb2!zNNl5`|j~Q z==+}US>KC(%rDe0!7tr!hTk5)Py7x3rT%sPFZrMLR{|^nc>(1C>jL%#oH7I&1{$Uq z9yS~@oHhJm%ruTR-ekPh*c|8`xG3;I;Cn&ALAL~*4-O9Q61+S3HB+={v}uXyBh%Rs zeMpy(Q6bwx_J({A@|)S)oMSFG-)!DvZVuIl28UWgyNC7)Ee@R#dN}mG(9c4@4gD>Q zg!zVrhQ)cD*zlC_obZzHS>Xr5UkZOC{6zTK@C)Hr zBBn$fjrbtqi-_+d{)l9e{*mF436V9Cb&*RVZ;9L-xifNK}Zi+d~XVtjObN&F4*OXJtYH^%Rde=Pp___GP&30)G> z6J{lBOL#uvN@7l8W#Wv)<%!QF{@BIPC9TWwE_GdQ>+)ci16^L~a;a-x*V3*dyRPf{ zSl3fszwY`=SEZYGw~%hJ-IjLyw%cz>Bx!ik9ZB1h_9i`(^lH*ONvFD(bl>0oVE5OO zS#n|Wz~q~fHzz-pd?@*?QIA7CV|%9b%;{Oub9m31o;UWqx#xpD5B5Bps!dHvElM4lx-@lN z>dw@Csn4YzPJJ)+v(#_XBGcm1x~Ju(Ri=$et4*7gwm0p$v_okp(!NOh+Rp6W_Go*8 zy~ti}A8v27Z@0f^|HOXYe$n2Xu1^n6x1@JZuT9^RelY#Fj4m0YG8Sb#mGNrE7a3PF zV>2@|=VdO*+?@GF<{w#IvhuRVWbMv+HS3pNnZ1g74esUWRom-^UQ2sD)9cl2D16z5 z?8xl6?8@xb+0SI3%D$4L&56!Q$QhM0E~hSMYtHVRcXC;7cy2;&N^W`X@LWgkgxni* zm*%d{y)E}Z?xj4E7n)a;=g7M$@4>te^8VB7Cu*aqL02$VV}A_5BE7+6j~Hl zG^(hkXj{>qqJ2eA6&)wB>{y?9CSEybIQcNXs}ey;d% z@dw4Hi!bzJ{i6Hj^c&f)uHVjn@0E~}kdpM0fh8+TE|w_$1N$fR@6~@s{~PBv8&kHk>_FM!vJ++BmMP`I<(cJm!IC; zI>3rzV7qx;OEgm;QT!k$lELc-frC#5pWXt#dxU&J{-hx^ffmpabS7O*AD~aucj#I0 zKqEM48LMJ9um*^=^dxGsXSi=^S(zCLi3zq?oz@g$4x#)#-Sr-PjrVq6?P>06OtuW0 zDcFu%T5pd7+MI0oI-*kS>kru9`cCo1Q!AvM)+1eG{2r4{LCmT( z1t}Z#T5qP;>%DcjdC_UUI{xUb)q883-uLA$CN~&SG7%UJmsw42WUc4838WzK0&4^L@i*uU>k8d30!ye{Wyk z8jDw&4~z5_#j>=%O?!iS`S?WT8nV0tX=IYEtG9QCHaIN8E5*x;HX95vHiOYY|U-9-23kmS{ z_6rU3^;I78_Ko0g0U=@j-pYFK0Hk_*dq;%&`6|z;FTP>ne%@?oaJ0AcQde)A-e8bN z%f_V8pdhV1UdCIzT^ke>E@uP=YBSMeS_I^@7) zu}$|em&&CKzYuZ%F00B;YefA_RJX9x4u!qCR1=!RA6v$U_{3P$z})7 z<}fD@u)5nZTlMi?P52~6TDDI@hQ zztB`|A=VQCaFB$Ug2A`IwleKOMw_uYBO^W@SCZp_^!SAI^o00y&AnGX(sXx~mA;~{ zYI{SE*1_Xqw2Qy>j!h2fD>lmcFu&9`$V$y6O(WJMF_0McAiHGMiNBI9$cD?BCH@B4 zgKRoGYx;V&V>W%!tn|$m|Kp9PD1FWJ#cc8aY{$5-v%i*3(ifG!j;|d`U;aQ}#3Oyt z`Q6uOQzA7jr=*SArC2Q)v6dm!n5l{)Nej^gQDinjPI2~}1 zW=f-+lL7{gS=}(EoQ?MGkylxn*DZcba^H$Y3o6Te?tdVlC?!88CAN#7(lcYif`|7m zm}Izhz0dS#E_&=PJvu* z>O|e>Ycw^Rbp8;4q88~+Ki{6EJ%d9+{CwjA{bcW`AZwu6D=e%_LSB$AG`=J(w0qYs zg*g$?mcYRD2&2Y7CDIlaMI$3K?1Mw~QQb#{hgvJwA3m&nzjjPx>D@;++**@m8Wz~K zZ1UtgHr(VW{q(c5J9o?}q60L#hymSwd?jy7NQkdroWWZft}|Kthnc%~D@02neKP`3 zdyg24G0+}i&{v`E>!KsG(gug>=#0u+X~>bocT7r)*|lNav56T)mej7Lo2E=|OraxL z*NZ!Lo}E(!eAY`}k&neZ60@k@HGc%IYg*Q`YVFgYVnTr-qX9_aq-!()m#lit%%`88 zx#r&vn>zgsAJ|)PY{N}XaK%5Fd9Y!hOb7g zK&?#sbj|}UN|{osJdjh-XYF~Ii8h^I%dIKPF|T(3P7X_!S!dQIVw&g@vl6q+8Fu>O zW9hHFlKz+URNJ zK047sCo1S2x8)r$3@`9N)I;sm#&%D3Ce>;SFCPMb9N2PR zZp1e~%tUCr1SD!Q1`~T4$*>3Ww+v%Ce>2Hh${z<0Dt}P#g9oYiSmovO=aiRd(Yf=q zj~sE3dMSS%bY3{9{7JnIsvlV3Ia;K=bWY#}wnD<*Mmrj`0?up8VsAUfF6KaJc5g?2 z?uJEpfVL94Ith%+$NW&ITq1^$w;qhSfe{53-k<}NQ>S;_H)ouGwR!ffM~+hS+Uu1a zI})X`=3zAR&zCQ3-*LKbT!Xc-ZiDje(Ia|V z1b;-gK{T8ky{s*4y5LZ{(~qRR&HK@Z`7OW8vrvxrLEr}S zMP=#WF0D|v=R-jmz#9!u%P-8EHRZU!K6Oujp;IQ$_ z?k#9=r*ap43V$H~kGqd|fWUcSNG&Q8x=!3{SeP2;zY5{Gsa56+c%0NF` z0FMvsZzRy9QVu60ojPtRE^RR2WoFs6I-=7)rcw~6ribr-8|1@DY1h44tv4wsHa(& zc5;#PSLH45F{qM$lGyyL^tdL^`IJ(w9OV@-1E&XxOb0zI0L=x$LWr1%c)L2@z@p&w zcr&+W*|{{W9hFERQZA=32ANrIqGfd~IC#hDnbY2Xf7;B`JAzHYrlZPtYscPRbkDJk zac!g%9HRHCy?uRdbX;6?E~v{(KY)Qe7R>9`ZQcUV@b!#_f_!UxM%;hf`qw>aN$W>9 zPOjZ-_R(s6%$(kY3AMvmK+^E(D@G(s?FQyCAhjcOLaVc7W|6E+IlXOC^TAMFrhQz4 zp&U{NgX*?grLhzmg}H*TW4>F#mLOUg@Vqn@q;zm7s1T*t#a;eYETOY>=QMM3F8zuMK8 zkMWdD59_Cbuo{KOdYywY}asq+w~clUAv7>4jX03zd5H@dFj%WU|a9o-g0%Hy}5Mw z$ihBRLkCZ(d1%q-%8ab8T_+@m1;ma{&yZo=S(XwU+j~_u$}OAaoZE^e4sU(SJk96w zN3gUPpqr|3Lsh-9GCB1NT{#W%&!|q0Hk!g$3o#mq75@h_!F=RGWA^ZQ^X|WY-n`-2 z0SoVLJaMA&?uEkwIc!%>|?WD{1qMQVKHj&-~?=V32 z#iJyj+^PhCsDadm%5M^*Mr@MNE}jx>^uXfBm(@+&x$~}fl{XxpJ+!a^Q|N`012TFq za%c-5TfAhtdFHP3=N{ZDQEj2~(dL=dXX#qb#pq>avM#lk!!e)JQ+>-%nvbDlnn0gs zEyp3pB=kY|qvp=y@0I^3`xGnvl8&Ukzb}4A`9b+msib>pGBvgIJ}%Nn(9_5BpH(XH z-2xWSFUYw>Ln|MtHP6UQ zVYwMgHQH8~{_6=7wS#;qV4^Ma6bqX%+xeQLYlbf1ypH|Lxum&Rg3C`Gi_s_t9>>?F zR#T&c&CnKJ2^X?ieAk-r-49gYMeRDk@5MWj=!AK5)MVM=+yVTfcTE>%gYNP%&3#R0 z<>)IDwb|f>YW?zBl*hOQ*(t{pN;giFG98ZQSAd5rb2J;Fzuk9bBC-o!@{{%(?R6^e z*Hag709~6}8HIspwDgP;1G?U)#LzQzB*?acJ_2$}p^qpP+Uq>Of$qb=GO# znx>B3zx<1I;i6iRimHo`^<*@7aI&{HC_2Yrh=?51GsfFclIg1t?>5ZWH#BTs9tgzE z7dX!J@Sg%_E<6QkZPr%&p-a@}LRW;Jzv4pTmT7D0oY|VMRFpOMr>%(GGR^8d23kpL z`AIqreg@MChUu#1t%^A)BOXesFpjghM~=2zot72fbZFIj<@>{j*Ut{A@E<>iuOcT( zH)bDgx5O;#+be(7y2D45?{A%bXUxj+bNG5z&>>&}U*|juRLsd8`k;wf9m;g+X3f`E z!Zlwz-1DR57x@w73q(G^ZhIOYBR z6tYLmK|aU4=qCCb{cW6cpYu^nklmUwmmzPE4|u9_;KtQH zh{)_P$2yiQdD&D(STJd?p-ns@)6xpO4P(@T~(VlQfjUfG`%d)*WD^3kTWZFTeJ zax>rDd3D?5cbanQpSUhoz=wHqJKDuM5x}YcARNn~0WF<@KCCz5< zJ8xk(IeRp3l0urlSNkVqE2kOQXn1j86o#);lj)E2r^(Kf4z@=6ck?4sMRR}WLKn~A z>j92?Af7@%NJ{fPvebOHG_}bIdh-{m;fC3##(l{mRFY8V{G!lm0Y^p@U{R zY}w=JM1V&Z|8qxZsF%LDX#TzEqvN@G4aUH>F3t}Q_3|q2?LZ&zg}TS_h)$LuP7itw z=SgsHsY3^iPuLcrYSK_gO^tTQ@aetsBfBN`FX$z`CM{{cSz6+t-m`}eGz|^R&Kj&V zbE1Uat{ej0r9f}*i5lCD1gw+o#tBWiyiP8g2G)IJ1sSN;oQClcEG(*R=s=YBfo68O zhp=HGo4jIzN``+lj9>n>C0eD?K07&$YCgYj*Dh;ZY@o5BVWH?NWV5sZV;KY~gKpZ> zLd@v0%c27f!g0gS$4;qStV=NT2Bye+XN?R6OL`%bke%K{tf%zC|{Q zap8?{5Ilwk`sU*M-2;=#z^tVc1&dloCKYw4^JWkDfmq*DZkgjNLU5Z9l@SQW!2dtd&0iO}ls-Uwe7*Hse3!ZPJN#v6h{xopP5Y z*7>UR#X*pmZ2*!LfTeXC=@;t_Mo zb#k$~%rarNigAvNUr=9ByC%#xl12dH*5aP?;9O#f34vKr@} z`cYL+)U(mfZ4b_zi8j+(zLNex9Y8_6&^=f%T{K0BR-&iuk{MnSIEzQ!n42}2z2VH9 zJFK$O92RD-tQ`?Ox7Y+c!aFp}VyVxd0!x|Nt#X5^2M4E4Q>0RtA@Tb9`KNU|x4R5tYnN)EE6Oh}i ztS)=F6HE9Nc_9<13|JL*Egt_O++FovJ}HCd#sz8p4bhYP^bZPxXDW3-NPuK8b>CnN z3^Z=&ZZb##Ap`6g24hfA|2~tW4gT7oxVeK;e7x8Ose93i(xKf`N(=ht*5xEf1Eh$g z5m_bCu>;F0hHf9`rT6k0wtZ+t*}&N7lB^NkB3ZeVkTWN@Z$bZ*?n6sg6m ze4e}W{n7b3=zKYg?B>~d^xmWMNfE$KLQWkzU)t7r=)`P`yj(iOHBsvB3fF1WRjTU3 z)Nzjr=c{b#!HNLiK`{Z=$rdc=(E^9II+p;h*EF72)C61^7+g=oniz zb!ypI_6nQq7ih6XtYBMrnJ2CM_j9XiLU(OtDGb2&VAy;PCG%-V=J0vl-w|-%1 z|A|#Y`x}Q{S2bqBfa26C6RulgnSs5D=id)co$b#?Prg4WX#MOZ0a8e10QDU^a+<&Y zlA$HkySOs$2um`BgoM2Hda}VBSQQ*%GA5)>o|U+KPe@2um}Bgir+Cp>iv#HBsk_al z0((?ay1)No6!sZAa%w=poQ>=5Q1!(c_Js7Cwht_wx#%ee9Ue{&JCt1BQMftzbWY6D zxMqfXy1U)luxN>yPJ7JQv}wlr!u3^E_|M~+^&2*0#;`zx(XXJu&u9n~Z$<-uGZ;0` zbjhgPNao1lBr~Ys3vf=Zv8h^{1A1HYy2=f;LATU0)P_&=Am+{3T$mdl`EF*VwJbS`|V>_wX66HqW` z;_Z)2ObTs%a_-Vx!!%MA7k2GrTIC;5z^x#;*%OoO9?#OzD2u0i-fcUniVNuMgF3(E zW$b$B;6m5))SoSCS43~!z8pHtHQ_aB?&w!)WlS@;c4>6b1yq zS|e?exSdRcy#|S(3QlkEo2zU4)*)_P+hf8Ds8_K9=k6G`CW{3Ot(&ub`<%L=0W2%a zr)U1Cs`~n>QTaWk{V{Bw(yc-=4B1gvw_}Jw%2Ix=$nTL4#b-%=56)9-phDD1ThTUF z9>Q@2-xdEy57MWUr|E#^-{_j}s#O*VT|bEjA@0nZ}FL35|dvl`_aSPl9j=&!RV zAo{s0+^1;Fm?B)-LU&Y8fANkqRaOyKTn5+Dz&0SF1Rv4hf6wR)ih?%jSpcK=OU^1-E(doef_e6 ztm|VYlvF*w=%(uY8_J5ul&kem5%qJwequ(N+nKD&9*j+EZ~|x6p1}!pTR~Y#MMZ8- zw@~9qV?zIllh#f)_3u;t;@Vrr4KO%-@`}fdUAIQwK+D5M=H?DbFn5c#Tl*}p9963i zDXd<&@bRjC6Qi%s%3n76`diS?Mh{z;&Xz^L{C(v8s;x`tR?>3ln8G(BlnTCzRBf3M z;CQr2T{PO6kL|p{;Rx;m+hui*Y1F9MNSdX@X$Cptle%12m0ia6Hh1HFwqyO3uieJi z2*M`fijK0wUdw|aq#llYK2hG;vi#Yh^oLOnZPBIvl9Q&L{AA1WFzUF}AG_%IxO_xI zq#1m+cyg%kl9OXB$;lRJMt6&)JHL?ETRB4h#Aw2nWeaaMIyQp^ z3cjKCCyNC-O2gkKN1|7#FO z^E7>`LfjsuQ)vyYnWCgCcJ~vCqx{{ZQ0fgGPxWUDv6scw2Egpr5X5RLGXpW;JWY@% zS0ysDJXJz^r@?jMh)`%G^rhJKHw-c33g2%eIbj~>e{QJ;TB|iS@vn$m(tNxB z;x%2$?{J56Ryu6t*Q9-^#}ogB->JRB`PtsbwT5fY34jZ{b6emuVmyEeJ|5(0fv=9~ zb7`zcIv)>_pB9nZJ<>Ve)q19qfAjPf?2e@UMEyKy7xlN)iu_ZNe!wGrZp()v|MN)y zUB~P1PLZD$we%6`-yr>%j@Pf&Gqq)!7(Y%=YcPJQO$v68c0P2h2gEdWd)RFsI6PeG zJFn0il-t_8?9w3iD{J+rvtJz!=QOvc-GwW8t&Y;6VH=-|qhWC*P zn0X9AyY#v2F^~Mbk0L)UVv!!{ynZ#kjD>il^S-O~Pi6hkcS=5>CaJ%)p7U0!hCzy` zNaoj6*u?)8;2$%%UU(81gW+v8~3N0Lt?NZd0PIKdZjw?B^1m>*a8HO7X&Jk^B1u9&wrt$0O|_`rk2qF1^nqo#RpDN1TthM>@xs zTF+FPF4BQL`J|{nPt-4X40r%&UHGc~U?hb$DTEFYPFLt4ssQcPKLoEl^pFT$`C|PIy)q{FOq-&0csFWGO9tFyymk0SWwi)kakyhw#_6V3 zjVjEO7cXq`*U;TN(LLa^9=@UHHPeBIVi!Ik)~}I1m)_%%-rb!a_=IJzHGgnxdKnya zZRu(5bnsfJ$gTN@yVJpI`A%i*Yi~KPw+dfeB=+%k^onF=Wh8KxDeNGoR;@){i10{X zA-uT#THur;Qar@V{?R?#Ty#C7WBvT32FpMsHAI+95&Uir9%szlb^gS?9WBK7o;bhj zHf{5b>|9n)wWgNg*P;q!(t;dcWs>8-v5`mao5KGfK6e{ z9m)~mhwH8KeK(Xk(IIt(1c~eJjIML#hFKn3D%>}%{vEfAPW5j2`E|nogCmy0M})w? z_U=2?>&5;`1_&Rbpp#OSPROTX96P4Z1;^v#tEO{05&3BmdB!81(}P;iRC1c9t1>{; z|D#%eORdN+WI$^=BXd8*XXF<$K*Q_*(Jcc+x{v`HUcXuoWB>}dd>)z%@WFU!nI18& z8rM`74iFGaBBo!W9hM*4zuSUb>6Q3cmm30Z5342f;p?U>pS!2bGs0Dlh;8-1(IP3& zF?TLsb^sS#PHxfgxdFQaVYFclpCwbq}l-+Ihp=D=*=3X}X6$Yz3M`UsYH* zj4CWsaRvZSPZP2&1L<)bMp{f>7cx)C0QpU%3mJg)FFo?_Y0ck{ywjFnlhc~NA2~1j znx?$#is1w=M+_&G)F4jRDx=jN%NG_Ru=C`5t&yDryje(eT6APcudK4}HXLXmB0Zhc zSe_c}nNS#L=oud8pJq-?%=QnM$Z=bb_6|c<_~T3ncigL+jhe3#1xDMo;E>0)i`@w8 z7}?R^s~ubcbiZd5Ld#aSv#^NAdNg-SENBPjWPukEC#pM+I8j(YuN^5WVV(Xr(W0ZV ziobTmsBVKA$Kv9}SeaTyJA5J6Dhu078Q$LCM0+eid!0vo$eY};Gl+rJHKK2ko%M|( z-sbPSr(C`;<@x#AlXW_cz^FlE0d||M@8wuHAiY&HrJ%)pq}`%YD^$JMXbHMYJtq%jE&O zG!cVs;hu%gqOjxDmOBZ?rlo3&odsp*eFT*%Ng+}oLj$Po z?*h}P)@+R6yESwZ`m|G0I|f(DwVJ?iY@|((Hw7LA`C;C1+429$8k+NU;2}y|2)+(l zckO3z^L4m(I&gL#8wy3=ZtB3w=XTKJmCvcoF|j@WmQGx8w!;K{&T;OX!=^mS4z9HGe;xzSEX}MQi>Ndc8+}Gt$-k zC3F?=&+WGFig;LXp02db0A;$SP?Pk|+a!zICN;gVy$pj}#1-7%Ew7!lD&zcBc}J{K zbU0-Rt1mTlPU9&^;OKFAruj;R|K+Z;_QHLm8d1llH7ruYBwdkq&gHE!cyS4R+lzcJ zX}%h3_eC!?#!wBwb1rv<<;6wJ=+h3|K5ckxvo-Z~*_u>-*|z@Z%hw-*wp9LQ#<^3S z?oMz^tiRc$;QUDy9i44fkdLV|o9o3Q)(>)v$NCA(@#~gvjB2J}9z| zl(DP64#CFsq+0LQLC3nr*1AieuW&zI5chO)&m<2wfoTVtf~qaRgJYD=Ih+$50|xMY zV*{FBWZN~-SI+YNW147$L?S3s@uGi1Y(V}({}J)f++M=#fCq@{UG0LRQGcU@ZdGdA z#YWd?u7^sY>}($&t&w0Hf*tF9RQ`qV7pT6BvX)$~2dL@7W~AD;kS_A?M}9@(JmJjMHB9SB8IE!kts3j7VG_UCwodz3?4iZyipW6u2PCID-~s0(~=*eF+%3JxuUn zUeXg*dX4yV)a;I5r+SZA^p3&oSBkF@oX+|FFVfwh{a|rs1ML1hkS0qNPU_A>NnJKy zy#djrlK)lv5NV~Le%A6lV&{K{uAv2&L6nYIeM_z`P@P(O7C_c?=LN2my8-0mwM=75aSH<`@{oG0W(6cem5i>9RWge}!Ys8~IJU)&+1Hc=~ zfZlW}{|rLTPaN-ye0*antwKhM zu{a{-Vl1E;K<5{+E`Q|}ravloqB-T~&LSTK5S>In03=eP9HAI2Zr!l+pb*<%wRTTf zHS4^g%ZEB`$Av3xIdFx2pX#nxN!Wy2SF#*!JKIE+09;HXII!18Pc4N=l4?LYje~ z6a=HhAjpT)YaI~x5pX8Ly{)t$cxe~PVjlqy4il?7 zT?W^w3+OQ=8#}9uzxv7{1<@O(DYrSFaIi7|p7y-70PTvh^j|0ozb@<&#w-)}59%@= zs(uLnqm>N4c}#`yOOv_uR*VH+;<)_HmI}K+i!chcr6I7 z-V4)w&$R$i*Ydy>UsDQP;bh#)9=PIbN`Wh+uMoI00dZTjU7>4mTwMe14%FQq+Q-{S z^lBK{fOhoC?Envoae?L)&&8D3(~YUhL;$m#()_ApqLe|g-E2eGsSGEfO$6%aGAFzJ z@*(Aie#v9ELN5UQpdN|i8gH!!^>{)qg4T>u0pF&YYIf}^qQR@W3=d+Kso3O|n%=gz z=<@h3+3&MbPG@R71Gk$%W8yvr`n$j#Uytt*`pIxLoxCdSAZmWDpQ!o!;k<7i>m%|D z{Y1^*j~w&J|5$7Oa-4VEmcJP3YW{NaffyS{%TM}6*v}qL($Q1M*C42F3|0%=+=pMJ zVYet{h-%=SJRnp+*(1q*V8{gM0l)iQT1ufHj!d)45>2CDfweZW}-YUCSV4#{u?xi^oSVSb^3#|EW_;yggt&iLfO z(A2?4sKFc>!tulVulrr>(F!3&S9vV098&m;B=>68NEF!hlk&WF1hBFx8OmDd=k87pnG1iY~eer5Mw6%ruYtBMEVsxj_-B1 z^O@D@Zud^v(kU9iw|Vnz@IP0Jvjo&_@XDlXDJq)t&AXeQda{Xcj>nG(g)QIu@ky~c zz7v)OJ{gAiBGlB z?C}?4km(u&b^eIGX<`g2)pT-)M}A(v$WM##%RhX+srflCDe{9Hu7r20 zD~gyIv1bt$NVJIsJd_==aq+KoQ<~((cQn4%X|sGkwz}D|)22Coz@(lLdH^g;kY#uIGqfuWb{*wo#Qcuy+l9DuxFCbaW!Uw$Caot5M}r^fwufy#;f^@$@#YY zLdNs_j22JDt+jqGgPIv zT7NnD%_Be83Do+_7ovWl`@AF03;|8WV?FC}UI@mLvvB;q+NV)Day*Wl5$A~DP?4_5 zRUO3o%c3#aF9w zCR_&aI1|W#ak#bS=dqO{e`|boBkI{AWDg?Xg#6#EjuT#n3)yqMnocgN<0|rVADPIH zjk9X}3F<+9?jsZVk)Gs{pTnus?h>(h0pv z_i?puFb;7ji0YPDQkW&lr*U{g$k4!Ey$0h4dFE^%RxNN0;PpG!>raYb8Kwdj0X<~8*R3rU{*Z#H|L?t z<5;;lC@wCXy}{2YTT0E_emoQtk0r7D!|y zboNd7Z9aeSxkA9A9)lvAf@SXTp&oE?!<7IEcYe;ChmV$TzvTfx+*qB}F4jh=2#by7 z;D!eW+HApLZ*S&Dskj4h(vC)$;^IPMwmd}l&%y~Rzdf=4mxdZ?svGnyFCz!sDcpdffG8&>W zb9;fOWz)UKMq_SutS~Cc*VD@yz9$&Ab5DDQ=ZVhriPBQL9am^~Nam7w`w|R%jaNcF1Im3(rNj3nLx3K`7U#YLJka49=+7xQ zbt;w)s345dO0LEOo_yFQKbB{89LIm9qzE&UJj-ohLLDfg!GUwU4wRL!DIA)dnyyXq zNFUvn&Ujzl`NvQ-wy~n+C*2vWq21{<a0)GRym2lfwT0DJB9O{jz5uYN#dkftAUL&(T5FP&{ItChI3|*xwwH|E75kKt&H!m`Gfu!&EHFwuqFCr@T7fM-r>m8b;yg+9 z%)Ml~&pDFoitEriKRbf+8T9-sbXz?N(FG&UFa(S#0#Eo)!w-#wz1n^D)>CZoSm!C{ z*|DrYFQ|F=W4C(if1Tl%tjfqu!&2M?}Z?1Bqt!~w2c(cfCY^&;SkLwVrMceT|ApP+UJZ(3W;K6wi}vG>r?X!RTRjI-Yh4NLU$vZfXK zB@Ku0UVL`v-5eJfBF&e)O%~2^({c=LJ;e84QLbP~WNJ&fkhQA*$kX|P0O_v%cGb`? z{y_OyI-jRwKlIlE$F(g#FiwZDlq>8=C*P{+I9Fw=NMG#AkNFHZCZgSaBE25zj1GX? zi>HhAg-FM`1@#OhT&6Q3+QpecK_ZS5NU*hq$!6K5ARBCfND`X_UpH)nXiG4n^LHQkrzFoSx_7%|IEy@PzKiUc& zNrSy9Tr#wUzVm&nFf=CgpzZ_B#Q{?3w1}Tl-glEYrF>FlR9OX1DF3wl`WtV>Ip%As zwH2?e-*|sS5A|^J_-gByJGWox%BpA&oF{!-gYCK0TESU!CR0NuB*_*M>+YITSu#l!)<`zUJ0* zA~xb@iXUg-lSc^BH2j)?>yU0J)iiJAoi{zcm^SR${N~P`Z*JbXcH#b;?pzuF=b!Y@ znDGOq`#gTzt9!4lmo9-SJM@4 zf9My=5al6AIf@u$HWnesh`^th} z&EG$UEjs$)-1$*%K$jMm8BBn7YGp^khlMaVTPD!F(ZD&b_ zR#%5k1S4~uB{`AZc7L;Sh)>d8;Qroj z#2-ek2M(IRlYKbVd-5C&c%|!jI_%D}ngFXCUWQGM?w_#OyNV9<RD#dL#2g9pNy*?<$CsWZ=?aW8c}ldv``8mbt4NR&3N8r=C6i(8_NO1^u} zfCHn?E1&MzLE~xUXUDzv!d`M=C4PhrU_f^{17Kd^`vxhONnCfSY11J@y3iqrd%u^M zvqHC6#q$G;2ix*{=o|wm<_+e!=%+~Epyp@!YJL=cM(kO~x`DUL_rwD)#Vvn`vxcp0 zw2Fu`^}H(a!#Ls$FboHG1F|$h#mcluTjO`%ZQr~(sb^k%Tmxebx4dw0$sCsId{^^T zb+xlF-m-puo$|SIYEgV-A9M8l@4uVBV8ILypBle{_y7tv3^?YJQv!}zu5}7u%$xB0 zMIlz~lNXC`t2-Px#B2i`RtuC#c~5hq|FPqIZE|96#)RArKVwPaTDH)NpG#6_Tf3fs zoAkru$NZt_EB`%u;=~Ob4s7_@y=wVy>ENWUCr%tyE&?XkdDP&GnF3dP0Rv7t$2+J6 zWA+W+uiEdAap-Eu`=2i|Vt{E^4~VOb6qj)*9{h_$B<_I7m>x4f?T z?FSZ)$nGV5%X}X^dGbN$Z%kft;J^~iS529V9;)uuYrH1h=_6lw^xqdHcF{TQ&4&8d z(FWwCj-US?$oUscr{!+@gO~ z<>&+DTD|5M)bG;gRhi(ThcIdj61&8~U07F7Qn=&x3ABE}e#5~fb?u2@opMSkq5t`B z{f!!oKj7zU*OGEiI~63{_Z=Uy0Csg)oP;oOU2X@p}@W zfj9vd#z(G1`4H9az$L0{WN=VT2KSlRGR$rwSilbAhYd7he3~3ut#%xB)<5w?JwN=R z+Brq~uNZt*%^Laf4{xkq@Y5jdy|1$0fmWt5U^FllCE2i zHXzGX&MyuUNaO>{Lr0_^n0clez<1Ll)sHwA&SEbp<7csuYN;=Cs$qM-JFD13zc<%N z-#|%|m=g^_XNPI}2!uD+*=?Xkb@s&K_qyz9vdN$eF$T-v-26C3h&J}}Jqi@idmj4u zw(kx+a`J8J|H>=MFK>VT&}wDlPwbN8<*i#EUo~pkr_U%~-!xu%@0rin%-I4qj&=k+ z0e`KhGi_!tdUP9=ey_A_eKE@x$(?Pv?i>c-^w; z&9^r-c+o=TkXOT|x8K}!i!`(OC;jxfI2V7KyN~>wd-OS1(AXTz5AX>-=hgT}%y~=? zd0W$QKIcbPfp_4i0IpaSE;}jrLdi>!AG#?>8y!#=5D8&8cV1{L;FofIRh5vEn>Gp7 zXnbKwoorw|FCUU3;vgN@;`fA~S9)KlU!Ywu9d*t@P{$K04DhYCa-KQW>>dZZr<&W& zIM)%Jhp+Pivrdcr@F{ulDFL^3-{m8&VigV-w-RMzl|;bL_?kz}FJaTeM^{Amt5 zuC!FMAi?^6Vm@3n@kyp$?z%nX-c;cHI@IgUISlV+#~P+<$4Cp zFI<}tW__zm%YgmL4#kjbA3@d(ZIb`d6WqLcqN}wot>kBzJVyv4>7&XcKi`%!K4abq zSVxmj9QAKbl!j0P)Qtb9vo8URs=E5W_q};D5RyQ`su&mq6ZWi=$z%}%NeCn)At8jB z3CJWF!oZNhEFe*e!Qw(`ODlycRe`#-KwCA6wXM}!Td}p9OR3^lMQpX&_QP65NM`=O zbKaYmNr2k_hvvL9_uYHeyT7~4m{nE&&*&uSS@b#D(an%a9%{R>M(n3N7i$N1gCPyN zrO}KhJ97u*&~||_&8pG_EUr7baBp}sM!~yAzCHL#kGF8|$B-%5zH@pbFY`_hi1KGa zzW1WC`Yr6p_j(wg)~2BGjDFv9k|;QCNAc5oCONYI`jEW-j`erpWHoueH+(iRQ9EWV^gaGG#w=leZ5VHzu@<0gVSaSbc#As~`a}WTO2V~p?~085oY+)% zngcE`7!!dFq%9t z_C>e+2M-rtgUisj#C*khyiex6{bu70Bcl0EO~d6G+^(zNt?~4I7euF6;B!TQSd**JcCN@abR*X+_51NSz-XEaEbk&jS6)PtAamPc2oqb-*z zwdKn1Wl!h7?C^&E7=U=DTusc%G#CYC$BT z4#)a6%s%O7=VGjtS|qdiJWL*x;y{!sP$zoPqW-OozxFDvlO_g!f9IXQTl38g!Tl9; zou{R8jlE)ja6{#S;cJGkUU%o6zYk25{}?rsC5(<=0M{m3l^1CUSgQ zBPw5{JS|I0@z8yy{-5ToV2h8zAMFj*j~FMQJL5=FKX&(T`omV96uYs%^$$tz#BSvi z@S!qGzK=&;uS-jpE5Q-7WN3{ieB2#=!oB8JwWe>Ta;|?E{UNfE?jD^Ft)rqO)Uv4e zfREd)>~YJ#gs;R*8m?F4vO9Esi1dCK>1{@y1c9Hr)dl*r5bbuk5oUmWjI;QWf9gy+ zdVVTnJCXc<*6FamG#|3~67wNR;a%z)gCF%9@&9{%sfNGgmkVS`OL!L!GPn2FD&Ir7 ztq$KktXbQFRwjjSqZ@pc$&i~=Xx?McWR>1xn`c%eWm|4d@!|#&nxDcjMrW_Q;qSb)#j8)r zf4bAF%&||p&zR{-ncV*;C2ewwK7&91zDah4+G8sJLixMyC#XEp7!OUwji_%0KKvjM zeoHP`7yc-GcAa9AzYXt{H-=X9ND&L-$nhv;~AIorT5?8d25rre&hF(esuj>b@n5DQ^z4CFde8O{KCuG1%H2#}~_?UauDiQw@eHY8W zF5F=xt9MKFRWqF~ze4S{Wd+hE>0@lv8K^7uN*T5D*lVWHMZSFcG){Y-+%FsC13Ns8 zjh-E0uRPQ=AOD)d*I`v$I4G^vHJG5TskUMjyXMGga657=3bHD-30f|A#N#AJJHE^g zqKQI8oxWJ6FDj#b#q;JB`}+TG3A)`E3f#)LTZri`F@(btxM06Fh%woZ$Mjsz;%U@9 zh?_c;lRT_*3a@s%p_#X_(Ys>^lc5Zxpzkd0nDd+hXBjg&#!?2e`K9Yj>CmJp4mE7A zp>^8M$^NVB559X^E)4(V^t%V`qj&Z^iaAkB|J};|re!;KI!gj8qOI%X@muiaW#R;M zj9H(^8EY%gvD)#QKX2&=4@LVqgNmcF4K2J;^1|N?AAw>klD~qPN4>xu+!x!VhsWzR z)-zv@@5?Z>HRve&gTd{)DocZh0eR6{_#Jz2vjMsJ*1Q zw72k-7-v7EZb#n=c~qJ=*wBhCJ~jd?zjz~ObQGvwgFO%K8Kb?|U+;b6jqB-}8y*lU zx8oyC8m_j{RQH)PZfxj$!c0X>uZSkp%$|{4 zg9$ZMW6zk~BmKB%t>Y09_>AqR$s`G;kzg!9|J4mN5a++Sg~sxTJ_kzk*JKy?EFX5FHH-80IV@hEOMCU`yDh@yQN4U~d|Gd- z#}CLq#>A&{;Pm(btYD{liswd|ej(F|p07Og47-J5C*EUSx-wOD4BTO#rK)}X(L3z% zPJ1NgowogakMS<@xH8rDvHp(M`cw>?_vy3xJK8t%ka1TZda-m{AIi0UV;|kx7xBmf zk{P@;P5i}L!MPvZiRg+ttS0^T_~a{%!;G}YV-F~}C>^TSm{s{*1N%y~0~e=@tP+0_ z-zI+JFPknQHkp*T2uOx?8RgUgUZ~9F$Hh%H5^`eFcuo67@>n`kDfP-^4KiXy6VjdL zbojb9da!o%73|W=K6e?t_r(fz3HpPzxn}Us7^6tcgGWz^8f2g$3?P4Gl|0S1g8W0Q z_21EtHRKTT@O_IorhMHtj>lt0y-Zs`553-^d0y{4b^FTs^H#2$ zH=ni>TX__WK!x778mU!v~o|H^H*tyzP=!sW{g3+n5Y zZ9{%n4F0WMeg5riZSp=n(VE*DmKRdW!sY#ui-H<13L&3uQ{NSTv=%`(%&lZ6ZS$z_ z;#$&&p*PwF^_YErbDs$_7&Wf=X-mfLn+0$&t^1MTO=62ut(_oSkZ+ahz76n+wvTO$H2aiv>@l8?G|OO~bk>Q! z31GgQ)`gFz>eKwAQt}Fa!@}j<(jI=xb6CD&3DTY+?E9fFF{oT&6XV{bTKqtDKs6VA zTBpfAUaokVE0OSt9_7kv$Z15FJUpVL~ETndX+W7aZufbNs_|~-OjViQZ za~98i=o)i2W4%82RzAaCFm=*j|9$YxnS=6&S6A%%*}s>`?)y7;*_M0GITl?0%0Ald zmvRWJR`uJM`}h0n?uy>WoHdvBrrH1FZGODrZ(a^fAwWI$hm-exAzAHu@Ex2Sy^t<_eb94*XFgqMTig1T5C$Rd%trwCEj*DAY}c_IWn#RV zg3LV?<&)Mjw#nfX9=R?#6kCI@Fz>Y z!Q8fXDvr1NcK8N=Zhn5QpW%v*g9kfO2%P_#dBM4@|Msar)Eut5+I)wmIr3}kT#nj9 z?d^x?Pq}*FR06W0`lMw$zG)^y8uBY9F);5#8+wN$kI1w4x}K2F<6PUg;^BGWPs0Ds zvySP%Uunz20}yW;51CC zt!3oscF)b~5#op_G4jy2T*r7&8k^=Et9^Xr$c5=gj;JNuj~?5;{n$~ar<@Y1#R0hx z_nK@QC{A^bpQ=8AI5*#nINv*R#B%Zoi3j=Lj67h;wSJw~9H1_Yi4UczQdEye)4eX; z;fLtYARyyCpS|Ek{ooRD>Vx2CqnRa~AVkZwreXU(E<3=mJdNuF%m*u)9hGFVTGs#O zt%+x4$rp#cIy3G09W(EIwXEvwxQ_6e@Q)L>E8)`c(VUq-P_9<~)Kn{G!UlU)R0k)-Gqc$srYx;}(Z*Q6-r^{6B!E^7bDYIPJvIeU_sLx`~ zyP%rIf`D;WJ}59z8arihjuy8&cc8%VgKc=h(}y?yBo^RD$wnBci~UW1zM+qG~(Pfzi}T`7+>6ji18ws)@T zX-=ssYIy7mS1egsUr|}#06nK+|K2ETFZK5{efM7S6s*jXWxQK&JnF>9$MP0E?Qim` za_g_SKO#S~+-zBd@{BQ*asDOl%Rx28U*9Q{5FWjm(Y%-QvN1mY?#5%Ed%5Eoy3g^F zmpg_xU-lK;gZ{)O@r-&zeG6klyA;qVSsWJ6%tz+OyKORr^Wig*eNz#6D#1u4${GFY zMOkS<1^%}BD(Y@3oqV+!-E?Gm`@$`jZGF4c%@=wtl^1%yCJ)QQYj7XV)BE){cu+bg zt}#MVq-#+(_wBN5Lt-R4i%$v*)`VAwS38jiee>`>#R^{`-=R*{{Z!y)AB_v|vnjfR zXuf@){Du)PI|*LRb;?5b`0&3TA7|}77Y?5>{OE~Xr50lE<_KPiAJZeo)E3qFL$CBU zCcIRe(Z8D$ZXSBWxBT?wtpg{Mg_rORx`VF!rmLwviQS|Rl(J-i|5W_A3`e>%IeMe8 zawxpzB7W}-+%kOA#mt7@JFL(tOX@c897d}+M^8!8GplMWCp7k$>%#m&-ceSw6`NE& zxWxRPueZ_}cn|>l){lsT+iXNgvo^G`;wqcKOJl zYulBvw0Xb(1J9*|8RT5!AOSsI)E2fU|G#82OoM6~x_qu|GS*mF+`s?xg^V$u@=Lwf z$UYlZ0XfqyZ$os-K1VhfO1>Q9Jjk=|((<6;xr7)-nRpKOQez(0%sccYC#D>zIpK10 zh?0C!-Ur!1Sza$=r$LYA0*t%?a;E>~O-!kTVAQ)HV)`-aL+gCdK-n22Q#2E+W1uDo z$k*h;i!v^#S^LZAVrL`6vP{}%phvU812R#wEOmJ-4LFZsMt^~##K_dQ)5{%voCkz5 zO!XF>XNkH4-;FP-tB7vw-rh^(qfgB<3+V)mIBaSkTa(P?n$Ad+jnSbhOrZNkxd5K@ zao#9Jv21bZ)FGp?Xlc=_3y-#gs)-A!QS#37_~c;FvMd9wSp)hHEuVvb>r*$E&|z>n zjqzcuI)ilMx(e-9)P{TqOzc?xvUUH||6K2TKCjw0b!R)$z9Ykq=EPLA5;koKg@#x& z+{X&&{?ZM~x@e1F&k?lKCRUed?iy^(=-Tmt+EDL1YRN{s);H^-DtWM><)0-O`s1DG2*4(Mdu#W0^?0f!ed zz7*e5Mu`Sa<>qh?LodS~geNhVB<7ODT&9VU2%jcKF-&5Z!f+D9)W}J^oyjmO@*Che zjOQZfO@lng0rNP-6*&PsA9_s_g&e*Tx=$1C$g_YRe%r`2gY;HL!Y_+yki-WlaZBYi zMdc6+hiDv@`Yq%oZ|(D@B;7sLF>Y2byCmqi*= zP6K6^NCRc0V#;ZtOd%RVrn79*+2+$(!s(!V9O0zbbP)uX>7tvUlE5$#aE2HeJ_k4o zvds`ljHiIw45T7BEpk5~<&zoMKk_nQIm1d$Tg!Mo<0~09atQfi26z$dVG4&iyq6&4 zPXN>yk}qZ`i3DXL-p*vd%w)gJWXsHC%glrw&Wf3AhncWLx|qp!n8|jS2|G{-*9EGLfaMHp8Lnj5 z$ZtvVbe23_>}6_)`E4&j_;j*JN0}ukA#FN*O1Oog#vvqmI!m4o$srFUe-;yeWakXF za0bhq!7^vC9WvM>nH(pR<79H2OpcSuaWXkh7UJx|H%uyzSsW*e<7C0tKSv1FNLkSO zWx#y+Jxdh8FImw2q{!ktnFVSteAT3~nZFrP@D-NNVO?^VLJo3KD$WEXTREW1aX_+| zgDvJ@i#c$n!AOL-P>VY7?Klpwkns|5aX>qQwG4xtmTCzHB&YCRf{+0rkRctA>Rt!9 z6P`fvxvp?P@>AHsMfor%{uGEQYVmnF$%U2<8MT=)gytV=HIk_*3_B3WS#Czn$v zC=gD5ak5{W@C)Io45<`2;iF@KWem$1)-tR|-f+S@&jPMw+{2LCCMSE!$)0k;Q$&YK zffHI2wO)cKzZJp>X;T3uy+!$@5Gub;NJ}B)J16_j$)&&vI~>CaWn_muwm=?aJ_(#^ z`#f+wA@Z1J9$O%fspYZmdE5%*f!Yb=(~&4^F1CXUbO;AzP-9Jy^&dEMyNBa!xJ;-;;<_66pdgXIP0=wGft}kd=|U0fS73yjIA0 zwGcL;x4i_}CWVk~wJ2np6tYbUAsdB|O$s3!Bw?==!X{m!2(ldqq}s0tvJp;sqlmRG z0yUQ?;x?-YbO@)`s)%(gVjWA^swHgC5>bj-!V;`M9s}6GIOX;dF7G95w-PStC7_ln zNM-2%K4!bQXxL5Z4jlPLy&5lGNw?*6v~)F8B-_| zRj^?hr!9kC6q6{FF@-XwP{uNpF`Y%M%Ocig5yxKynJdI1NK25UEoWZk%&VMvl{2q$ zma`oF-VYIna&I~FDra8h%&VNaECz)QVlixf3Xn?5V)*?-z{QYuF-pW~z-orI98R_I zV)n>l@gar7*A-$hWZMr&bTvMi_@S@sVb0akElR=f@FtEj#+Uj+p3anRmpLda-5|cXDP>7 z%5j!*oTVJ6isMvqsjT9dRgm@+zS~k6tm5{l3X=R4IN70!ty+bgPj9JJs$z|*m~s_s zRK@hGKp*kh=2gh;r?5JeY*Ni!s@YT3ELAn9t>#qKEL9E1tl^k7$cG<-AnOd8wAu z*0O}PI3wgN-V*m(*1Z;VHi%l#AxL`FF`YW5Q^$1bm`)w1s^e63oT`pf)p4rjEc0@f zc{xkC9C1#GqY`DPxpx>ye7^vdCwEiz4R%%W$$F|$JvADfUn><4Hyg6;|xzq>t<>mhF*q^XoKo; zvSTVB<%fFKt{yV)7xj>qAo;zXb*xtkDV0(LxPq;;f~~XywbMwkf<3YVX;Z}t_R9)T zNTqk6(7>8DAU@$VZfXFp6QY4zfd-^%7Y$thHy{<^)cb7!-xH9Ya@tC^?Mg^H5;*07 zmEd?>tYizX1V_Tj!YkRrZlszFovHukMq0wDg>thu-6$8QftSN>ZnmDAE#QV!h|lu4 zSrRu}zzs=`V-}3O=3$y1&?KB_dYGn%X?mC@S$QPFYr)0Cls!z@!<0Qt*~64QOxepi zdYQ79HT5!OFH`nX4S_u~pewGF_D+A7ZTt3a(n ztl~Vs3e*Uv{=+J!78G+3Gsv?sL5#Cb0C(YS5F?H~fHWr)L|>XhiZ~|KU_q1)f{PeZ zZ5BigPjCrCn!O1^I|^xFnly(KM5!l8b2ve+<$_$x1;tAglk2gdLSxdPLcF@U|IiHy zj{~RKfNsdS0g%Rn-8>%bhMW{q0NZv$&dGp99J7?;kW}5Gf?*}YDu&ezYZ%gar(4u9 zq<&gAWF}rT-swhtwFl6{(95t98g=8G7m7pu>TZ^~n`Q3doYTYJ>EWEy!`|s(@AP1l zfLmI}jf@dw(}l?Gd|qEVCP_2&cTXo2A{&`DZus zk4x-EzYA|U7wtwaq7WKm?qv#lIqhCfyO-1MWgYkOh;=X1*~@hHGM&9lXD`#)%XAL0 z{D)ZbLoDqfPIU;WQpF*Te+cmjC;1N}{&7Ic|A(3HVdi_7bv%r;8^mFxB1omCm*e+x z{9caV%kg_TelN%G<@mi6ALVdbWDnpqG`|L}G;&B|d^*D!3}1E^-ISvzKIs z-EIR+VEGSFOtean3awH*Jcrp}z(tX#0P7_?4i0MtPMSj#ERjQIeEgB%cF94!N10)#|s6_)riw1}m4G^siAX+p) zv}k~6(E!n+0ix{yM2iN977Y+B8X#IUK(uIpl)DnBMFT{?9T5F?K(uH|0<~yL0<{i+ z#4C|nG(fayfN0SG(V_vOMFYePCm`kdL~79h(V_vOMFT{O21rsRQi}$N77Y+B8X#IU zK(uIpXwd-Cq5+~s14N4kh!zcy%0(h1Cx{je5G@)YS~NhkXt=bVWKQH3?Io_6U*eki zC9auYLfNelFTv*oQ5z#qpic;hehwh!9{|z%0HXB)MC${HK8Z}w<8vLGNOiJIq&gW8 z?G7O3!vQH~BGt(2U(9e#jYs{>qv?LKi^jg4|4TXvTmb#i6-^3P6fO^8=^o^BCsz<1iA?|K;GJ z;}Yw{3JhGqTAv&PS8?)qG~5ysM?-kM5yy)CVj%;M!|M1O@r4Zw_)ta0YxuSXTmwEz zJjJ+`!o`b>+c=!gJ(QMVjQ@pktZEWBh))b$iYwJ84IHPk%Qgc?%_MI!a7#=a4dL{a zPg;g!RpkVE#=wV*NphTl$H_gi&%oowY<0JRC&*rdR~*S{$UlN)(}El)J|;Yoab2%b zz!NoHp3%UQwOt&4OicW-z(*N0$HjzS0X$JV%JC<19GzxLOq|Iv_%x2M+i(u!Cn+tC zQZr>97DGQiCOqDdfBDu;{03ix?e^x-#!bGqtuyA@vobPVbM3{!puING zx~{XsUhD7hw{P~h)cRYyg1+{JzRdw&yS=2{@7vgszrx?%5eT)}9dk1>VsZPDt~S3t z(=i+LGIR7adXnYq0v-0Xp|(!@7GH3n`J;n#5L=OFzycZWHh0FNCq)M&U#6yiRoD*@hKzK7_TXcjK(YpQt~@ z-w)NN)T3e{!Z%}ID!sLf5`AkXc;rm zMrMe)z>C2#h-W(}wjypP(;=E2_-h9zKO~`;wZK|IImnzZFGW6D5K7qriaJLJ(r4hm z%Z1y~7Ii^3Ke%L~m7a~KE@RFhZDVyUMx0ipAl>|sn&fXrSO=tQV;yw)132NqF1Fxp zJG8Uot(`5~!B&QSq0d$hZv(v`Xtm&15OlWyZwE~uTY|!fPbY`k0ZB^TPj-Zom5C$q zN@M=SlfnnTCCX$|o$FwlL0Cce6xq8J^#|$YXAQ|iA+{39r_&%C6WRD?=)wEqFt^lOG79 z@=kRC>EnatH!-g3AC)PZKPeXz7hMa|lKc_P54x8&abBYE`QYj^a#qx5Rfb$Xya_^r zf!~yeW9uxgwFbQheaj?ErlrEN$WjF8GT*)pT2$_pvA_sL-E=CS{7%}9d zPf>^w!nNov%!kAakgMrSMVVNH{`F$iXcef5mqN2@cyJkN&pOn_G#lA~F@PI=e=qv{ ztMC=&I?ep`GIJ7s?Y9p4kTim!+-iF;6+?-H+zTg06b_i2bPW5(fj@tpV{X%YA0 zj^e}Om^gtO4ZjDkHj6#5-LGKD7tk;Ht@yQgN&E)w%3ATV_?`H@_&!Si|BA1P*TgI0 zRe1IT@ps(Av>txkfV@UNI0(C6&v}S)YA3w0Mf?plP&e|zjbfX)NjxbIVF&jY#LejU ze<=PTo|2lhN}C)ehs!w8FT&W>5|4v=6GcP{IZ}?2Nw{|`S&o)t<+E&^Tr8L1%=aINM`Wd3Dyw9* ztdYxPEspqFF6+ew(I?J`cd_-QL9Uc;91`M{jdB&X!(1oV;6(E#iQ}83U#^v{a-9sw z^>TywkqpX>vQ37txA(7dlXy^GFWY5@?37({vp6Z+}GsS<(+b`{D#~o z_seg}yKvC-0r@R?kGxmjClAU)SPcJdEZluSJ}4iO56kb!@8S-Jqw<*ip8P)giwEQ* z@=+Yk-76oLPsro)N%=$hl>CwWvHXdATK-f%BcGK&lh4VYV+YbNVcc}l)1|405A=c~RgPs?}Y8TqdKi~Os6 zPrfhzCO?oL%D>Bh$bZWJm1pHg@?Y{}`EU7&{8XNkpULy`g6xz1GK`rCp-7zbuPPSY zw`o;u$}nZP5~qw%;xR@`R7NVJlq4lt8Lf;_#wz2K@wjE@3gt>=qH>jzqD)dID|TfH z_7mXTVdWYnRXi#lQ__^_;t6qF{9KuVd8Wt3^B9f(4ELTK!HJ(Um099x@l$2CGDrMa znJYe3(v=J)Q^``YF{-{#$x$3iuHsbk6qk}OzKMIl?iP26e_~JW*TuKQL*lCnzR!wp zU~E#PT&v7e<}1a@0%f66qLeCS$|9v)S*$EkDwIlPsZym>D>b&Rwm?S4f-K{iZ9HAJ z;*GxM_E4M6r$4R5P3`{8eyfikw&GB0sLj8@=F^`e7B&ako4Yoy4f=1utxqN%x3DGD z>1%HGw{^xfo2a#<*$2|r7X48IKE6&{slm{1Ff7#>`uP!8YNn3!o2aeS5W}xOt))6e zKR-q+8W3be>i{0N$RrTgYNGLr(8t~A(}j(1jrlR6d?4+JbpyDiyvf&YSqETU+!+YA z_^knc*cKa_1Po0U>zV{~(=9e+4(Ly1@e(Dle#DXix+B&P;PDkPg2Zna^rN-i?{5qG z+FAn5)=FPD%=5RWV88+hTrLtMv43 zx`Eq#n?fC(?V(NU{Ay`itLkrSwN)F+hYaPbb>&0+NT^=d)z<23@7fsjb#*3$Vt-j{ zbs5@q8ERwL#<$1(u-57_wCj&LJyi!kM$`?MZbZib9=|+>KzwJ+59@NBOea4q%gLpk zkX~C46W*Qt-AQ3)wg2|rF9WZsE^etp)2;6t=@2bm;M~lFd*TGEit$| z2H!e>TRpn2-Ta92n0Ys@+eEcssI9dlu9#%eqxnqKR$R(KHlLrLBdR-szK(S|9vZ;8 z4#-;Q(mF$Jp^k)>fWO_}5$NDwamB$+>o82ji{ZYuP^UlW5BTCsH+2NSn1hFvb{g*& zqwI4~eD%fvRVMn6`k2UZ)f@e-dZeTPq7UMwF)zykf2U7dqeit+}C9@q)}_u z1=NN3tLX^nY>Hj+L@z4QNF!qOcbv~OM7%#nqhSz4HxKE<*qAQ;eKaWtYMkEEgy>o; zDW|pggPlH`LCeyO7b?B%WYvh6wt-a(vTC}J3l=JEUCIpsTS(VWZC@9%c93$J8b8!d z=xFd)H$lH<{6QQoM23$ivQe={4iPinps9P!c*#HFI5DHceQN`O%#4hz>?r2QG_fob z8+e;zhB-_u*TkGAmS*rI!guv`l1Xn!E;NcSOT7TzS@p)^;EIbX)XC12+WLE&LeX5Um!5Z;4`7w;pjT zKUfbG{EWPWuC^A;MmC4q{Vh$wgzLM|EKp~$y~E#P-56-2o=JzlIn>rN+-OZBI-%n}T=`>dNVBrbu^64XB@r_v0pw zo;dF5x0ah3d-n~-Owm&&PrpkoRY~{Z}Cqmq7tb{TF7Eq38T@t z|C5=-WaSm<4fJkO*Qr)C8L8jpqpVsAFe#FkNs=T*QkBh2dT{__=Uol->=PHq@YARo z3bk$Qi1Bl&XB^|3`lCk$WvCYi_|kbgI}8}!b6(MGu2jIn4bQT<@_v@3{K5vPomg-F zA)bR+mAJODG0HI13um74YBrbugz}-y4XOw0qpp;K)hM=FTqW#zHG$o&da)sD7+b6Q zvODp4s6>6-%Lb`mvnpyw+!Z#@a3?;GLZ8*F-f#z-t9--im8rOb@w@=fds)4d$actp zO?j2o%Z;qw7{m^#eQ_U+vRTgiO1#q-?ZmJwbporWHVyS?yE~p2;`$fbS&8usZf>Bv zk_$LWSh(~At5Rp7-aUB#BCDj&beE>#^IUu$hxZ8fcC4Mei`DZcv|Wd~({WEmospui zD(Mx#HjT}Z{$P~~eZLib(%r~RZ-*uzo<&I#Xcmz3E2IdFbA?x%4bRK96G>B2YR-2GD4vSaita87u4T^Nh90qxFU zO9Xxi$2VN2+W{kRedBdw|Agljd=t*yEegWs|?I@!=ji36y;V#CG{%>_B zS~Ls-{%QO~7lb2%_rKhUZi#kobtjr8dcfTqcTbG>Q|I*u?sPRduRlN|(M1315w=6= zhdBoyNYAr$!3&^A`9)ly8PMe-=e@oB2Ad~sXY<5;5Sya-g3lq#XbuG)Z@4Sdo9__c zP0@LY@GIuj?QS~8Dou}I?BFw^b?1Gx^FD-lkLdrFckrd)4fp$87DMzx^Y%Zz3!bL> zL|-(wPTnSb5|6vzrC9J|bn^kVTXQqbAJIF}oERI?Oe^*UU4pNUv15_~{Ep)u{1p}s z{;8MS>GDCI$x1;x_52}LV1PU{3p<`*7uX#n%aju=Qphlj%kUTLPx8wc$EpplvsL`N z=BLGY%h_=GDON52h4mnmO;#46O_V9!*(1t$mZ1i+f#Ul&*i@>6`5caVTjf1$s#3%{ z2zdedq@=Lnf|mkWk?PNCl#XmF=HWKT#S+mbzE?hH9n?PPKZy0m7~c}*pbNTF8I92} zi4_s88UDj2(fkv=f_@JYt(u->9ZX4VD(ZBku^Uu&uR5XmxS9yK2w!gkCc+usS4&wa zwP!rmd`an#K2eu0fwM`#6XZVejyt{t?+TgUeB6aEwGGChuo1=tHq{u7&wsE`LuXct zzG{ssD>0oxpDQtTk_p4uBzY6?q@rvra0C8UcQ^kE{B^?`QB9Y?+Y)^D2=I}m<4oxV z_#yj+JeZ7f(4y&4;DhA-c(nC7*3dgqrye|UiY2J;q09pz8)?IqH{R`>cM6IRLo1S@rWyc!=8pAerM|9Jc}2~vU~!7m{oAvhr-AtoU`p=ZMAgmISm ziyvLIUp#Y3YE+w>0YMykeiA*uz~18R(DPO4ee`@1Jug7d%j7KzR|YDN#oQnBYg}Ml zXk47=IV-M1OV3-b>-n*kp3Uev+}ZP}gepti#SbnXx%l}ds3OhH&EGQC{0^?Sn%`)C zz4_VZZrU8}UTtF2X2&7N`;LQ-_Z%x6%N?V?o&K%y?76c)oc;dnw`WhC{rv2Sv&YXK zJA35p%Cl3>PC9$X*?_as*MENf``3%Vp7nLy*U?`Ge;xEy6JuX{ex-f&%~v0N^}$zu zfi;2S14jmQG!_Wl&%mhf!u9{+U(78Vm6<=AA*C>bD2y4fKc``59NIuM$`JpE>3t)jPhy}9{7RtiFR}m}{R2R)+U>(G&11{C5BKGbyh)NJ1-!`E9>DuLw@PL< zPV$j_r7lvTWW;=ONyU8L#}=}=>|wTmEn;ab~H z_l4Dk)rUP5b~xNKJS03JJTp8$yd->GxE3)iqAFra#GHsnB34Cgj@TKoH=-%h6d4p5 z7uh`>0=|v}n)hkm!Wy z%;@~+lITaG_eTF3t;Kl8gv2DoWX9yjOo(|q=Hr-?G2g{pifM{9#RkR3#mW@3Kgq{J18`x8G*{50{K#EXenlMG42lHN}`mh@$E+vF+9 zbCMrPUX{E#d1vz8l;o89l&4Z&NI939oSKz7BK4ls`qZaVUr61T`hM!M)Gt$iO8p~E zO7l%CO-RFeGr}_BGEy_zXOv}BW{kmI_KcGmUuQIBDw$!KahaVmi!%FUF3YUXJlw|6CZJ7Bn^tXd+jMKwuT5o} z$J*H2oNF7^wyf>^wp-htY5P+5+v!2O1ob`t_ z)tYTBwDz$MvsPKBShrdCTd!tI*`C=U*)iE=+4Hk^WuM6YJ%{Cl<;3Om%o&g~DyJ@I zMb7@5-*dfl!*b(tJLMMT_Q@^Jt;wB|dr$8Dxm$C;&%Kyu$ji(t$*am+lD9AK%k~lN zhqRyHzOMbT4&EK2I`r%?pu?OFZ*(}(;p+}f`62mP`K9?~`PKQ8@@M4N<*&#;mw&0F zsbglxl8#j!>pOnj@oJ~GovJ&n>$I)Y$xh#Oj_91wxmD+^&iS2Zbl%nZROjyt34H<3abj| z6fWs1b@lI>*tLDvK3#`(t?oLb>zb~6yCrm6)9qCE{O$|8KhypD?tc||7DW|h7WFI| zQ?#(??V?jf7mH2BA;p=+cNH%y{=FouB&(#fWK7A7lDd))d$1mDdsO$>-BamV(sM%3 zWj$Z*`DriTURk}S_1f9%L}{ziNu}^?u~_(SJ}@w~1}lmW)`<+r`o56h;~}TlLhc@9 zU$Q@W2v6o+_#i%!FXT`2S9k;e1~SkL3EE4lkfuowVOh&g=fTz-*DWhAHzzqI*^*#1 z1c!u%aC**mJ_r5H^L5`^vs}#tTXHPHK~~(dI`eExjx{)mekJ(vmQpl|5=$t*)fdKF zeZg;TUA}c)cPK)01S|>B+>#WU2Y8~n>uaMWr3ExpQiF^JOF~L=PIg|dH7hhE)cs4V zTRVBd7Q&#b8A}3yQ(GQIccOxo2AgxOB7Ni5jQr2w1l|D7b+Ed(1KivMPT>EpZR2&& zyTPdbb33X)RB#KVw`@oLoB4Y|2@aIv4Z(rhqb7r=WHOmNjktO6JG_nb(bHh^G&COd zrkkfI;tzV7OkTK9-&1?W5ELNggarB(`uL3F#in+iQnXJepJ>I@!Q|~IGG>^RFz-UY zSjmuM^51D{W5U-3-VusNdy}s+A}r9iv$uCuoJW?I6y+^m%QJX4?g(t}nwFGiGUZ`ej07O2$Nc;)@xK1P{;^5^ewEj%HJ%PPC;(D1 zg!!f=rFeMcdWDCF88S?!rQZG)i?`X&H$KVVyYd>4(xP-x&m&ZCS$o0X5*y$rVDx=B zAkSoq>V(<>yTb#-c)2Ac&QtOajWzLiJblAM{5(B&!2n>u+asmPj zIZ2AytR&?a0s^9!;u#eJ1E~U@wXG?pI1?T#m4FOw_YJShBic~aGVg%mHcCK%GWFph zLjt_ZP$tD#b7P&~b&n1T4i1Wr4hRYgh`jNIjL=G|RvDVnJKoh#XuK)Oqw$wE1ZSCd zV2OBV68{#B`;?(jif&_#6<_)U@TBN~;J~2h*nr^RfX6ck3cS*@9W^?|;hP>*Nfj%D z(xrXn<^H||n-XQsi4m~*`fKH}0r(di>mMBKe>6jsdOCZY98q3w#v6D)x}CE_UvnTT z#zzJF2LwjN$Lb*ZnoHUd3a3b8(oFG$>q<2som5hZ&29dTZ-P(X3zh_9A;CeATM%2h z)LBPGEnBEu?Sfo7}t3AatM zq5NsbaJuw9*gb}Hbqj2gSgaVY6hE>h(1I&IPyC?VVzkP&<<-Zl`T88KIz;@& zQ+f4?@!Gf?zAi-ku0CE;9#XD&@O4_XZJ13P$Jf(^k9?hD^)U1)!=hpG5{xSipE@#@ z1fhY2DJ2i9Qm7f9NHXU^sM52MzA@tyNgr-DVDZ9Y6==@YS1+mK-kHP4Mx8KcN5o9O zea_s<8P`3}8Ll0R4ln2w`gwFj=T4z_-+gz;z+u~qR%C|y@{Q?(CazmIc|gcrceNC1 zV?^PkfpQ8T>=TkVpkHo~_M!HiPiQWEgq1g-`Mk1Oorh8Q0cR<&&6o#I;fmYr1SbH- z5Nj3|&}8>nb1zrcG~Ka7e%x{H$tR~x!xf#D79HKHl{D|kC#SnTtDaZS&QN2X(ko4S z@<>{AOj=q@begvH$!XI?-IgMt7M5)9=3kU=3}vwO7}Jqv1kNl8OdwTI53PBGRtv!y z!$X6OzF52fa30}0Ii2fBrYhnk68@-06-Xz@Q(lkuwB*hXsa#=e&`v)(r04q6>(@^z zX!S-yRJ)SmG2@3Woc+@CJ7>>Y9MvPj&)0){Dw47z*vk~trXn`BLw4(_?Tm(Ge<{$jfEdmGz+IKzfZmwlAl}smYlHFbksj0E;kWS-2c}VMaEv@cE(DweOJ1lk z)R+PeFs9_C#bd}w{N-yL;p67kFJ?BN=QZV|Si}qEt4k>8~l;_&k z9;43HERHYboZMbMBE?TADIVD->h?YlcbxR)+6~JMBiA+9wa-`0INJN=UW0ecn!S(K zf#)&SHNb}ld{USVGgMWeCEkO_%R^pSy42>FDm|)w&QlD9Oa!DdHpmoDx`9ot*%KbA*u~jEI!L9AJzeXy19t_#dYBi0tvn{Kdm6_dT*=^1S@K zVdaZ50y0YLyY|0x``nkMQf-{_n0I3TPZlg0I`rK1;;0UcxuLmvE=rUh-uT?$^36|{m+#p0hjxmGKYV&){KhjY zc%pWy(Wn-U8kZJgHix8wOcdkWnCRgn;^RjQpFL~G37%r-?8x#BYrh0VEVDN=5QMsl zk1Q^k;BS&;lRwc6oR$);56S^Ug%htj9}4Ws2HiLU6JnhWhI|8F<=?NzEAQjPt9Dhp z#P3w%op{ww3cT{Z+n&_Ek+pw+b`rF85A`Q>8Mz<&3k46lt(F09pIdaAPB%#wse?<$ zAs&|4Ajq?3v`6c(kZ9Mn(+ugh5V{eyqf0rdz5Dx+tUHeYkq>)gRSR zM-S<>JNapT>I;V^`kBke$)^!7(e)@$IQ`6(Z*O`^TqEqmoHFuSdx04|$Aec%uQ__C zp;v$8JvGM{TC$cT+MCz>n>@kb0WWVZBrPdA*Krr*js->6aTe&ukMkDgFDqnTV$q7i zg0lWgtij1$mX6Abf%R`4u(3~q*(0nVF)=c_Ta1Ttls~MGzvB?)snVWHtRczWmv<=` z)PMfO!L}Q$ zD>>EBEG$737p6|Hm^mf8fAr(*~AxNX>X;>yJNf zU6FoB^7oDC;P~S|jofl%>9}R@yrrGhs`)w|%j5a#iIo$>!WVl<@`Q}k{JRF0P3w@V zX$Q7$`M5M&^Ods`2X5cq)b!0a+813Op9(IF!&_^$>f^^Bywea3m_Z}ZGu2G+vIL(z z<6bJKehP%$7;C8)9W`t`TeMHWbM(FlON8EPwbsd!s9EC@?#DqHokrPUg!pV@(bp>4DkZSLkWcfk=zLM zqH~~Eov>c}PJ35-UQ6I#!U5EoN3H+#T%)$0k83=~=PuS9qPUEItvQzN*ETdcv<<)j zjfd7n6QU7V8J*6bBt=(YRM->a{@l2G_eSj)UwG=5UruSW*QgU4$8Fl}Xxg*!xODom z_Ja2OrPF{M=mDH)PyQVbq<;V(Ubw>}XeGLzg7D2bMAhol%AAG&SCn0KElTw{skiLsT+*E%kh+uY&dSf4Fiz%!d0 zv|wp$qh^+VbD$&5#Q$F_s_<4P%KHS_!krW?g%-0A>9BcOKfL z9XR{un{@{d)=5lbhQf%4Hh=w%_KrNoG3wxw#qa6xhB)Evg0|dXB&}Yzbs&VT;69LtmmG#w%Y(rr_60XS1yg`pmNtQBp96!BbozpBVE*aA7Ra0n z7$ZCyV)mhMN;B=+VtJoB_3ESQR2wbDM7zzuDW9TV03NL5G7x5k)oErZ27Ba!&1cVQ z@7ND6Uh*DDdF?w7ZRTChDjAK(>khuR*wvRC^)viQ{?r$a*YMIq z%DpgXL|y1MhH&(kKyX>fSwZN>C!KcCJ+weP3L86D`qt(d*0rKyzFnC$_oZFa@7nd! zoY}H%enn+rI8RrDubwxD7tE_ro^BlU?5z9d%(?HL9m?~K!z<<$gwuRrP4h=zkh=tx z_;2yxS^Q7!wu`(q&%CG&=T|O5HN9W1l|FO)DS0^3npR8e9mGTW`{j5a=^y&*z@#+X z@!3WG6yNfT<5Qb7U*7L%EuCoU=D3e=iT>hHpKuOEm_yLZ`y8Iih^EuhUyWOUbP_d? z*V=X|#L$WAsaCNVSa_cgwefuIhjljN&zVZNbxDwQOVH6Bg>Z?krkva$;4nrHTxDRTVnv@!>wlh28_} z@CLmnFb85VM^F>lsPGr|tA%|E)ws4_fZbmI{spp9FTBr>tr^|F#t!qfroYsuXXDie z)}t84EAc7XZv;N|_Q}QNWK~$8@ScN8z+tq~TN3!Vz`nJssQp#7eFJT_`a@^}w(uco z@{_msrS^~2_I2#OA8XZp>$Tk%E@->;@l~RaRZ4{zL8z1b31F~l3*(~Oyj=O9txp2k zLA!as^B1-!^s%M-*63Dutq&hvTAQ$)_XFVlwkM45)6TbsjDQ+4qIEod+cJ*p^+PB} z*WoEJpnr`%j+*|2r$aiP4)J4aNB6HiwsMu7@FdN@^7j4f_5Nra5_63sjKx6<5D-JT z)Y;iN9*oE(iTJ14i&oY8q`D31!!_Yyo^5IlS!S<18u?>pjc?m)Lz*2N=9yDFGV6M13!NA@MG9j)nm8~?S3L)K1gS-CQyrnIeZ4KI3w7YS0s zm`F#%QcZrQKtWeNv0N+KfZ zEYT@%u^{8;mgrxKuk<}aA5a2?MJ^;w`g?t z;D$?qi9K_yiQ(Cu+mube>*;=ZMfu?-By_|C2c#FZAM1?Ab$TXU zL3hU?dK_qb?KRtL;G+53eYU0#<=hrs=2!W53EseMMp6yh`Z~$Fe;$XQEH&49Zlr;ik((Yr#M99G?4=7Nn@~^loTu)Zwdd z{uR8Tif9nvBbDXvG#Oewq!G4K>%De$#OOtJ6~h#9G6p2(%4`)>766wLE}U-px914F)@$4OI9jIWz|M zK?~k+bMEFqIOvMLbI?|~?UwQgKgHLaAO<+lD?UEc#~TA|Q&Q3f1N8REjE(au7XwT% zV}KFmTlgRP0E;oe2Qa|5JOd)EEdy+m-7>)J2($0I7~uUFV2Nvh7=u)$yd?i3Xwzw7 zlRBWUrXp-5eE76%OD}Kg?2%^n_{1|f=l=NQsV{8qY)lLAkZo#6&iuIKY4Va0KIx&O z<0t1nknTBlgiou8k@1uA@EIAgY_4N3-z4Z$k)q_k-X@tmmOm?BHrx$O1R|P@d!dOK z_0Z)_0ZV};XfO$(H;){)dP%jI*Q(~NN~NI-vOCGgAf^KI1veY)3PG3@ zxyXac;uLB$l`Zp?a?M5WoOVp4HCXC0d*JAZsQXL1%}!Z7tYSoYLAGVY{M8#G21}=( z=cyBYrLmJ=3JR>h=OKTk?K`pDRMe@rm*=n!S=`iqP}l+P_;zl#5)k`wLU4e0e78My zapTrD$o+S14GONGxxmcFPJ2Eqw8!MG6-i#6L-CTas8gx8*NB-5MhhJrYlSolV;YJm z5F)@L!hlE^F&7j%8W_T1#7!xATp!{!*h6$$bx|juUAlfluLUa>bnc8_y*8{beQ@Q1 zPMsF4zD8AEYw;li#mjM;~u*kIYO@FE8~tRiWy=aMM3iGb^<>GBP~9 zynX3iyySr=Z!ceZ*Vo%qm!&G%Pa!S#6RZpR0mDJQ;71D8B6Vv@i{Og37yjS9Hj2t= zuStK&J%w$x7j9z`XtrT?u{OK-mZTaQ3e>sR2L5fDDKBdLoqm%%1Kye+PzD-oSPzO( z7s8n$49RUcvXda3@WXFqq8rJBjLLZ~o5QsR%J*?~@SvH`j*I1nA!Re4t#;HQpgWNQ zx{(ynh2{SGgDW07Mb>=U>j?4|qbzp}%J}7JFwWbxulAWfYw)199mdJGtvx-lqceP4 ztlRPpwoPl!++2vUge!BUJ?chX&vDl+DD_H?Q!5dIEGshg2$Lid|ExSO?YeSBis?2gWWr}_R)2P9$f)jZj8;^v%{EG3X=|GG zip{)c|CL?4u3p`>>k43;E8VYDfOg3CvjE1w(U8cx)PYvv%*%RneicK(JlXEw~|#ZNT-N1CL(IXu5@!Q5dLa|_z?(dmx*zPBA-w)C*W(fJ9IV^z&h zDx;N5mLOplEt4f5{w3}zc(1ooj&;He-*!A~l=gtdDg9H#`W772k;AP`@hkYZfwIsP zi|pdSK*}Y6H3=LdP%5V>p`%6_jXla+%aXlyX18vct%F0Ny$SC`a_FCMe; z)K%Gg|{Q(p2DQ|7!eCk(SGuw34{3Sk?e_=F^TJ-Q}qfyg%s{JTW)lMF@ zugV?;@USPQL7J~VLHaz!r+Z6zjt|r)NJ)ZjtAt9gV>~y-mfYu7irl7Y7K`w`#OYtPDWW4%PoB8fnN^m2N^uoB^; zMf$CB#?Ann%@hT{SJzhFM~(~}+FhHVj&QUMh$<*dOP8K$bm;w9wbv1MUhcA=T!|}I z`1;6~DNnNX`&v7&X~6+MXtQ*0Xv@}GEoAT+%2)I`M zuB$%p#-4C1KhaX&i+$x*{<*81)$&rQBl^+%{RCX=D`X&|a=MriVi+mIB0}e~%>>g> zxNdPsTwF+0Y;3vI-5Iv)o|RH?@35iwc20H1?+(U>qC!+??20RgMIf)eZ)(Aip>yU8 z9a4~rF-q87!wh+lzy5-{bgmZMjYKz|V>Vh1dDo&>2Yz)(FHM@%62uZsdS^S{Yerk( zN9|b%#4_y6VJe`#F-n(**q!B{=uGy$@bWJ=2k<@>!M#AwTacjC8ZQmv*9G_XBjgu( z3&I4bm{alt{VwL3@PN5y&xkp?v3xo&b}Og37WFaLS#IStr+PcJ`dl}E4urfQ+9x9y z?Kj^o>fa5dm%5ctXJ#sIK8^C8MrvQw=iM|-lpjR-NStVZa!&2kHtz(@NX;id2~iIE%j?!f|vXGQa)UJTEsN}lpmH}yB5NfUTbL3!u80e3qQ)g zj6}oj2!8Ak`b5AlVp;-zP%Vv1(s|^@^68S!BYHWFOVr0+Bb`U|a%x{M@5OZ<(aUMP zdi%8!@d#(f*!S{5`83(bTu%!VSz=P3A6EW=|L2zf@WXO`gg&i2cWxDm0NdQ=afoMq zg?L?{$k|C2@#4^sSPtoi1>33k5uNJFwNA5Hp?RT7S=ubbul98Hf4$W##M*XuHCI?G zf1%*g)}aI59B8c&k*cjj2fm@+Q+uT6!m#Gw#BWSaHY3X%Lj;ZU`{O;?NA&+X4Cn* zL^DM5B39@_nmV@%dC$^GEW_y{Bu+X4tbaOVg*KZW7gM`NKD6oVHwY^?BgC`(;9>*| zIa`9Zq6|F*UWHwSl5*q2@At!Z&SF|PsKF0Q6Uf90M)bzR%jQC7VVCxS%=54?5 zWqVuwVLc`Bu=HViG6FQK?6t|Q+O%EMwzy+WO^6|uv*fbvk88j4V}{_`+Q8f%WAe6T zM~=KlPi+Lg;UCnV6|oyw#k8&nO&i*Z@%r%)yng&2)EFs$&qBm*ZVKv9bY#UL<1Ln# z;K+ptIouHLp_s{vfS_BgFrYyZrxCQ-Q>RUKO3>7e<!>%eeSEIBO*bSVrXXbwmGot zBVKJ9@NkoMnhy>S>ypBy-A+IJ@fGlu>%Muuci8&}h7J2b8y_6nr4-;`JhUF4Qi(SQ z5?s6&#WJ0E`B;pz3rbavHy=&%3ev-O8zby}TDY;8sp}(c7=(@RXyU zx$F>fjFJ5ZYlv1}*e>o79CwRdWW@3FNVlVuJJ%(hu}MKLE8TI(^-1T~Lggcs!;kAH zJZd_(iq(o7R@_DUwDLgqT|Km0E6i8V^#^BIAM8_S^& zxs?+>sXpj63%8bb2yc2j(1%31@KKBQDJDc~60KPjgW0ZJ1)b@!Ul7r?(65ogPdCPX zov~#R`+c9HJum-!h&SBcw-$tFujxBdYomD>*E%ZpQ<|%`$E|OIN$XzHb959Odnv1?-M2x;I`nrBa3cM!4#d36W_t&jN0WCrMdi%)h;P7!@g|v@~ zoFV*mSc7`Baf67aUf>aVdqNLMCOop~Qa6FGYcjAzFL%m7(*2A=2Nw0AE4Fc~Pqaq$ zugONe{%0uH>z7Df-Rf^})|aubeTEx6q(|xXyWgVy?o~SckUh#=0Z$6SiCytCguMp( zF!VB%3Yw*8_6^u3>;4+XMS3&hoxwqV+@jnv?0=#a?OgJn@aC-(0Is$Y{=K-E)Bmsa zf1;=6f2&IcUnc#{2;IgPDqOr)YcGm?PDJR^xXa~*``_@dv>pD0+g+CO_1tS}v6ru7+dQIW=r%71 z-Nq<9w7SF(w7kXj-kh1k_13OS(2?TwHg8PSF?=Fgm1uX5vJ)~a(3Qay54gxW zMKT^Pk&ri;}?}3jY9}bWk)}a^B<_6A>^Z8zo_{+QD2m+Bp<21#EYK84fUJwkYXgB((4yDw-WV5xk@~xw~unX zz?=WjUKBaqA;=G;IlNg<*kQX~wE0)5XKv6&CZj3PMKs!?JSi{A0Cm@p<-c#4mpZea z#@nV|r*rtKJ6+jNSD%pIXl%Srh>oOr*@0iP6azF2L4n9cR}76;Q2@EMqxmI{4cd)60c4ienRTb17f9R|X-|J&^KHeAs4O-by@Ix*gq%l^2N z#L;$obE>ok=c5^+Ike<|IVpR!Nc~FG8)?b>QU~jAlb-ynGasI!9fHq9M!X0ACy#30 z4f*ms{g#gW8&l~WKL6m^7x2h>4jSNb%R&qMM{usoQM==ou-urv*5v&Uuwb3W1kS~D z>$x*}K3s5~?63XAAEbOZn{BgV(6%EVPV&+`6vIIny)@VK-jl}Vh)sC7b_yT^7a49+ zC+%Nve!NO-889wKJV(OWNsRx9x?;~0;h%PY^YQk_sh-H9;{#9;|Mb|;lb|`oGod$# zVA(%mh5w+vNL`*b-@*kU;Anj-X9H*L5yyE3X?*b*1zAl0=wyFA(H?rsjxdm0_9Nl! zDJDOFbx9>z50@cSA+85zb?tVZUCPqFaV;kTYITtNasfP|4QVCXpcBUg9jopw@cwol zb*%x~Q1Y{T11=Z}0RwbE9R{go(aW_G2>0~smz&$af35&P-r6@WuPA8ItOv#(!oUnh5$9FCp$Y1%wT zs8o0#mrz^Rx!{ARcvL&;8aDGbp%W3^o)Wh7KxetjmVVZ`KLz&6wH+$|9NTNzzaq`N zB|o}vZTZK5pDq{lTu;C(7jxZDqSq(AL$6=VcDmI+-cr95 zL%Y`gnwI*dtP%Z?Z}JyYIrdeB;4DA}$0HOmu{GVb$1)2gq%_ly2>Bp01Ll+X$;npj zXTAAqt;Xl9w6G~-$^zHMtB0n@#~katwsq~Dlw5VUzIo~Hs^p~7ZdXOa{cT_{Vi4d}jMbEhd}VK(Y1o6Hr1(gvGjR)K zLy>@M&UoF|?sTfszGvZ#zrpmQOeN(b9O@U$zlX(FGyJS1`3`gKh8T8FMBKG)3vm$< z@!QYeYzU&p_IRlzFeof+U=;r$vSzpq7G}uI3VqALu;(oCuI&x+7JRjCDGn<>Dg=`45<{!FoAGiGT~2?n3*p5E}+{>md@*=5;%<3}o#BPa;j}#uS9V z*`@VZ?BC}k+-mn$tKqlGRFK$e?OEwTkwXpH>7GR$@J~QhyE3dly#*-OWnMQPy#)X* zI3?L6a0=N}EpR#n1pltEmj`1Jfe)&Amf#t&2TjaDu5%8OMSYRiE#?4k(wgD)XY2K; zeNmrxV|v_HuTQd%>ch82<}%i+Ea;oG$E{Sim#@o^`-eSm|0M*&FFZTfZKvDJzugbF zV%jR7TWCVQfpgt} z{FIe;7;1}6x6&kOdX)n4ZY_hxLFyVU$BD5{du+q#p1REA0q)&3LPBk-F~O zEO5)N2|r+r3&O8UJ~-m3CJ`UUJ_LC<)_X7Ke$i_?5w2V3^=%1~hiiRz-=M(zxvlJi zkEk!`eSUZ#PbpB_vcF-wj>J=^?5E_1`A^v38PY(9Ei`~eW5A3fu_pqnNnlP3df>Al znQ6)SOyGfjNl&cR$Go;dYsYQEk1FyDD7S+2LdxCvw=SPWjE7=fvY<0!H z*O7O3cXy7OyiKb&wQPLF23Tx`9hp2N*Uce{MNID({$b>hVZ~69qAIqtx^G1JyN*YN zxNlDJ_MPe8wejY?D&F4ndb#!7R@bkvw^q<^KHwnVYI_%cl;6Z!0ZOKFoJUOcLGQ>1 zA=%%_S+3{i=rK8x{S+62>?ggqrT*ux`pA2@O>ZCV#ECVhGqnSI_aFxA}nfk~9tPM$@~&QhZKU zo^TCb*9x&4&O`Rr9@=fhHpj}5v%AnX$Fx*zb9~KPd-KEDa-n@+OUp0Wscjh}VQPVK z7&KL1@_x}N8*VuvDS7cKX*sU6J`w)2E?=?AFCxM(JR%~khL6|IW4lKDnQydi-+v*c zn zv8jK~O(96~EHE4`LJzwxDAiP!4gWs1(HC zc`Zd{MnYCmkE|$f9;*H59hKFiSj;;j3WhvESM$Xfrc184AM#fOT|K3j%WXt`k=G^a zuX5Jc>AA9*;^#z%FYD!e1@0Vw?_!-?sy;${y`0`QX`=3EQ`YJJwd?EPa8%?p$fcK8 z{&>1#g!;(Ei)Cfh&aLyUk)MXVeTVuGc_kJ%DT)1m}q~lvWhQMH;|9uIF8YzI`9MsJ_HK zlwj$0^$yezz5b0*H*(`wtEx(RR8{qmocTrS9aTL_MA^5lIYQsz@Yim@iRV~vl5Y0< z=JDZ6-33+P$(qOdyNRU-CJ_Af$`aWJf4>L*aqJ1X0h)1;*EG~6*h?1fk)hpB5o)kZW=2QShoZ7+WD z+Hh$reyMA;%iNDH^nL4GY?+l}{(Gqx1fGzy;f~ulH{VenJbE(k*|TlCo;}-X2|aqW z&Fax3tLdX%o75+Z+gVFWtk~t@y!X~#Ktq6xWZVkjPco2Km(F%`J5`6zqLgsSaoyQE zlp(G?ant!aoE6A*yoa)a=HES!o(M`k2q>g?>1t`N5A%t>+zA=VO=R&;M5b zt^Ldc=R2+tYMRE!74PR^99fH6XKkr=Zhvu{?LZE*6LvSJjkH?uAFe9&!UtlbFv9U9P-sSArYQyZRs;qYp?l zy-zwP0?$~_oG>Ja=X8RVl{8;8>~x+F1G>D`2{ClOg!1wAr^GbTAuvr%yjol5NRr=b z>gqfzW~VqrrksnjV%FiDBRVUFsu{%E#918%Un%BKc;|Q}#w^b5al(i5QUEV4lEP=H z4nSSVO`I)3$M49p)c1_mPRlzZ;Y=c&b@T7WC_@(-+ab^e&eXxX@X0va!dW?Z#@ddt zc0erd1JSRM=$rDUWKxE4Z6^4~D~~l!p-Zl_%M0y|qX=HKBYaPW!Dt6F3Yg%NQyxG& zBoWAafQ#qbl~B7ng=P*%8cu2HzpLoqD&7Nr6&z9G>KkYMfi69Gq_VN;K7LLMljk>% z;eTkJpa92ncb;GmJrSSJ8nBiHpYl6m39N{{RRYl%p zBH5C8xk-o>B0ZZN8{Bn9s~mWE<*HRH`5L?S(?{Qa`w%z(VG!*+D5+W6N;c!{=;mzdUU`%QYs(P?Q- zjjAL!orXfFzU_a;_Tc%a!Sh`x zC!UjmK{@eDgq}z|UoOgP^>U})I=uONHJS7Rj_gRt%HI5KF_+cNKg;b!IeaQq&LC8P z&uZ)oepZy<>#PrIL-}O%TO`U!)=0cJ2${-Z56Qm?8H6Yi%KOl3kd>le;2tL_@GR!vX6q(VtN3C~c6o_s~YR6h3T0 zdV2M!qHdM;hK*00xv*sHquMEZQL9Q%&sjU3+oc#Kvw1>s$;ffHYjYbX8)BdT^2>Fv z&6Gy1Z8)l(3V(ysk(%*D4;iq*@?i@>S|;f`&~ZA}VQt(w9>wF&X=6@g$;au4<)$oc zD#1Ij`FrOXme9blZO#dhB_Xk8A0m`d;?fYFg!Dx^vjK;-25YYnPPVUDsZEdvX;bz{ zyMYz^%2mgn(0*#c)(U_Av%L}Rawg_j2_`)p1BV(S+{OCgzLeuEwieR1TA(P@D3y*G zRWaC)M`+*q4Z6Kz{DAeFUfTFwW#zebJGX9;yS9!k>ZCNto$`~4l`b=$+_`a6Uha;k z7OsI%qQ0hTAK@$>ksrXBjJ{OGY*1lY;2i!$b9P<;hXVjk=J)z|;dtbNH0^RV_T3vz zo%zdJrkt-HalE5F*rDxNPfxA+OOH>IIW&waaxX(YN-GJYy0qY zIZJ0oK=xONu?^RDD_OuLWMHCxkZAyIy@|u0SqKSLgOdc6Ddu1&4e$qWaB2G5ApQoA zLxAw|@S%K|wrAIKJEY3i+J(v3BOx84OCOu$hDd^G5I6lpsndRIkaOwu47;6vgZFBXbNey= z9-gmQA#OhRB$p^aKW?dg0FGM{M-JEa4X|hO!1MaS!gSu!$UZpBan-TfevZeqQu*pG zuIkJwV4AAEDPMp*2xHi|BvwJ>%_+oxN;G#Nm_S<@DeKNNK^;@c$IpJc{ukmFI1r(Q(4?lObyX`)?yX8?jf?VJ)rTAi)K z1W~zb7QekkTJ&rGwNte6zJur-trFl6e=W8}uK*6Ex(2OI-Y4fYeI)1DNgpA4B3X}m z;K9E?d*r>JWn0&7qbugq*&{wb>t~O2DV$d!&K{XD6XO`J?F9bYLRON-Ak&JBO)@ei z6NTagTqx1tZY-+89;eU{ZDW@?AKbB~zU!s1#|O;hDchDWv#(#beS6-R9=Ul_3BU8tls`fP49l6HU##rS;fE5Ea$ha@x*CIT|C!p zJ5SF5EKr7$#aVyM^LuDJ4tyonDcKqlOoEC|L69IwtwcvKvC)mZ?A}SUChd9ji(@Bp z^Nt_?YR${{%$`_nZP>Nz=SY(_dUVOFN-`@?diA+WfGJH}+NDep}gi$9{E+PQ%U|3gbT5 zK7a`Vi*#t%t-=E0`^i*u+ChA_*vmW#cFJM05k>75?}lVF#5)fm#avrlU@AwNW_WDd z)6}$QRHrjTmO3}W>2cG`C3pTO(?Z{E^MIoN)V4i)Mm>QuSuf*jVYFQ8@qA~?9vneU zxN@Ge2swwC6`psX|5-xMZB5V32QhIs?Tth|%Hi@6^$?H7+;(VgH1z^*gUPE7lf#T1 z##og>w0H;!2o92r@XhN!6D8ZR=#9fuE%8bS-}dtPpI*@_`Nkph=MPb*;3UNT_JsIC zJ9Q!Lb@W8aNl)DWrUOp?Jhchqh;Y#ebh|*Yy$&*hWQK?@Nb?>$a%t`A&-kbj zi+mm*J;cLB7&ZGITcLfbwc=kL7(HCMy{yLZ)-{@dA45S*7qZn4tqaKY6IaO{ctaN1 zhr*h_;pkQ6RgoukFJN4Rc04FchT7qT1fB#7T3uvs+We(mo}v9jhYJe(abF{x6^+Tt zsj)a|kmmGw^MBO!l(WcRA^t$>rCsm`bRT6u#txNRlqwMZ#i7rTV>{PP-+?z3E- zeC2IzyPzGw(PIDWbEC||``)x8pR7;kq*!nQsdMV5%95jjZ+hjYpI&h+xAWCQ=g%Js zM$p3a$^KK?>zZrO7~$)G;ZI;n zp~-Gb=efo5$j_9u19v;7YkxZI;vmPiI6^yX8>Ly$7y-jIe*^M2FM(UI1}WdMrYTiUUgQ`nJ+Y|ilzdXE zal9{4d;zi^ihnRyD2xl`yGFCEa_Y^v?ddfW;C%*f~ zp)Zc}_^DI1ua2L6_Y>O`oTP87n=$o)SI@5k4SZhGL3`)@3s3O$-)B#piLTI>pdXBZ zBvT9Zv{26VG($Mh>5b?G(t+rON4jDLlrIU{q5Co*15^d=l8?@f{ege}rjy_8jzzq? zi^YW_0qq}xoqMBSqs51V@Bgp(C!FnI?>yj57IS-@-vM(g_yX_;U`-TWWisLNa=UP` za!ZRgPpm4QS~VoX(<5Q=B**06Br`vG;ozL|lHF}&&rf#C7n@GXsaS9NV?6(V^H)sO zwyWgJbmwibhSIAkm3X^9a;~pF2LDdIj;4KpEL2esf()&l|xe(YS zU8dUkIr>lTF%m7hcma(9UIX?*lcaQ$MHIod7}{R#>U^yqf$eS~A3A0_hCtBdij zkV9k-x)z6Pa){5;HcIXIRw0O%+W3Z{4?HjwlKO8J1=3HLN^6b`%0}CQX9)NkmNoTL zd*fI;e_kv%gZR_5+z>PA*Wa{E>lxZs9zxrmBvEL1H?~@PQ;UDo5_D_m51X9&gG)=G zU_iW6dw}jso6$wgBtA#|P}d$TnSV_#z6?($e3|;8&X<>!pXxMP*B+W?$aPObeXw+X zq2!YI8m`aFOS$~SD5wul0oz!Qn=hK`(Xak@GThFy#+pQ{5}j#x4F+|L?o@SDv z-|Y5Zz0cCg66K=*o!axie1$Wq-JGh9Y<<0Ue0>dqFVXLC;4L0_)6bn2PKS=j7qw7M zn$YP<=3Au4=`ij$HKmb{&7Zt!(?bXNLEEe9FAt=&K`xtnxllHUn` z3jHM+d%~7)FYrFFlFn~?yyNQqoaN-+Te>AUcTU-Z>B+n9E0JP!|H?7$xk1}QE|zCj z@_W|t{Es;I3eS9QK$OSp;{gsRknH&Z(Azz+#w7wGYq0q99oRx{MkLkwna5{^z(6+A zFM}nX7d|w%pkVGp;`jgQ?%U(5Dz5!!X77CtO#*|TTQ_#TpP)C}(5KUm{SRGrGUEN1>voAO=w zJD~IDFS9AtzUOw?zjVnS`7;DRuppl5G4M1@-^a7x@*!13&uqFu`-tTs?k>jtsq|KA zffaCVIG|t(hEDO=y?IIuV)2Qxq0xtiI_&ZRyK#wgLiAS?eKNU>voKuQV(Nh;E2pX{Z{(@S~d1w!ibmF5W;|QOQG1n zd>JZ$jiLDg(tJiR-?1U1+W*Lhx845X?>ARfZcdDj{!psPGmZ`TD>|casJFX_spI=KQVE2{M^RJ*Vi7n`YzHh=90Bxwkds;gRR3c zqMIIr^VR?D^eS2iqk;pvtg~^NB zUovEl;BgR2;k_PUhANheo*O!R_wRxZ}*Z2e@p+#U5AbwBeh6{R#StflprOAMStgq;Ei0oP0rD z_FT;>b0(K<*lyK$Pyzx#rt!Dy^@{e^aTWgj4 z&W#!E8s|nud?XLatE*csx~Qev_g!gRkr*4hxX%YS8uneM>vfy1le;!;v=1v=>>M1y z7-LgVrP&V~>%k)eTri(7o+#P@`lAr0F><+VzalXvCh-d29vyodkKja(lk1x=x~O@5 z2x;Fkb4%+n&KGcu1;cll*X%PmX=icK`xbKrPQwycnbkUjK`3#_?+6~nd|xz-gppF{ z&|xgT#n0n`gZ9_a->OJkHr}DQ7B6~xS^d2yKa!O=0_~HZ&)q6#ZNIj^tyxVvrsud^ zi#I;oaIYE4?mh3aj<#m52j*Yed2SKhLgyAk#tLIh)i7=Qj_~Qb@cE&k7o%>(1RFJs zlONx+*P3I*+iUJEZuoJ4+kHO;X~ZOq!L@qU8O`?KTWWKL58vibMLUd{q++I`t~f~; zZ$Q+ww_lO4U_rtaw;w&aL(A%UZy>gg{6WiBwwUuWGUvqFqz$vb4 z+Q{F&ag5@J@lN5}Q%?K!JBD6+ZRpMJPY#Z@n~zWEn~%m(gr@YasLNyP68`fbi1K|e}7$oB*L zv*Y&~$g0E=|0&y1wi9Of$F(9Y7>DLfF~(Z&JUu~LK0fT5i}<8nD!*@f`shQ$n%!)t zhLl}a$nssUG`+6rdRVP)0@#8t;)v~$LuPD0<;x}+`1?_;&3poFD-JBs1+s_p{5U%~O<@P#$8*0$ zb^gZFPa;VT|IHaF#t$)jhHtNEpK|DRF1?W=-ZV=5x}D0I@z?EEK9QMz!=B|@V7`v# zTB*L6&!)K|*jSaD^Dm|>NN+IH<%?z;&*_o~to_;!bW+(0$&xPDGu0Q1s-19#szqG$<-lKIX zRI%r zUnT^XiW@%}TOJNs$MR1#-#}yFj$J}LR`$@ZCz0Rpl&vy~=m*|dpOJs&7bDkCqv(-9%K3OtTe6$^nwkJ3n8gGi-YpX$w4fn zVh2NnIFn{*Eyrz)BA*UY^8G7_g?u|Yo@Tl~Q4NUSLl2O1=GW4+)F^)xBst%bEtDeZ zszuzX-m!DvAmMHo&5KzPL~q(ofR^RcA4gGHPDSt! zz_|7RO8TBYI2xutKL|eWsQGG#_ABb6Lf0WGdC4W!HJ4mcqy1`IO>Iw4ZOt}hfd99k zy&T6mvv@I&gc$4=iC6_soMIrRVKy0OFWdH_&C~n*7`#s`q|t>8*}pjypBIuo6-yAN za+hQ(5OEhnPhKa&T@=PZrp1van*(Pt>l5gxh>jD8SE`IOIWzI|HUIzFShYhB#5 zY4K}Kd~N*bTY*!W^~u3gnn&LZV!^8x!v{K#JenN0j!t@B8=ssUzn0E&UKgk3^8Uo$ zeWdrVKg$@avv7uY?wMzM=L|KEKieC2_V2@YUdc3HFjdmQZ!K!B?>#wNeyEClANh{? zhJ7EfjmPrMq-?T9&i1{h=3ao6iK#M0&KP|%*q>=n@mNY{yXcD6vtT`~EnQEsD_Dx( zHgIoYS2PJIeIBs^=jwb+_voB#^^4Q)2eq4x?o%hW8FNwgW~FO?1WocUxYSweJa8u8 z%17|&Ca?2Yp#SISWZmZZInGOI;RqZ{{AvD}*4x2rrc!rBfApVS^tbe;L#5+w$3)-1 zhi_7e`ZPM0@VX)2U2>Dzm;L{^zy8hs5AAf0?F9PH7xB@2k0H?rcoR$-jG}j>iB48I zT7;dSIr#lMewm#hqIXUpsM7=z{$oy$n!a57z@-NcTq>W8S$4xK4?H1%`tT(;$b_NC zD_Xzqkd)9*#k9Ji;CG9oFRd%SGkEY^R1|&DG=Ig{oS-u9Yq1&Ad4&hrzs3K)LGQZ~ z@WWgdL0?AL=13f5KYgBk0SyiCcwsKk7FpA=S4&n*j*O&j7mwY9C5XqAJ7M%0RlI2Q zU2Lt^wj%D$Y%lE>_vrnLuGqOqdu1sWg1mmyp5Z-9pUQnw!>*1izW4X8dr(|^GWRLC zIhIp2_&>4J`q4SqnIMT)?F4q953YC{Q!ficZDDF)-jcF}?*FX*^HA}uor8lo$x|B~ z+&Qb{@daUJZEbt@w6(1c(^9wrEg!^ds!=mfCFUz=XG%S6<%P5RsEpKh&N{y+F}xH- z`d5d^o4K`(ZVQ&69MANdB(b=WEgcY_T^cB<5x6&Ldo||#rTksJbj>88G@b2{H z3C1>BDGUdqlOgSQ^XAmPi&xU8v?~jvV`8GSt~zw+s@ViiH3kokH15S-)pC*+jUCuy zqP4*Fw~t?W<>U0Hy2qa@iMFk^>W`Uio1acGi7=aI=EA{M{-g20eX8`0H}*U-c<2$M zfAn>g^bqY~Ga4`3u|R6J??&4NCI4teOEBi00Cx(%lv8+XV|->at$nupb{IO2N+ z6d{_-Is)I2>M#C}jMb2j%Fx=GDYOtxzce(ToWo^Dhz^(etACzRZa;_nb=VBw7SUu3 zZ$?A}^l!Z_pZudtJ95N#>`h>Gv@uY-A#hUqGd)AB@^_7~L2&NCxA ztu&mOJvBRPGSBVDBVh9~B4tF=qC@qiZ)f|&+rRAAcF&8xXqS@-`XT%@ zbUqYowJ*n7?JslfKl!4~_B+xG=IHO!e}sIb%juXqM+Y@g>OVUDDIJ2UO&R$m?WjZx zv-MGZSbJ4_6=g2PIR8&$V|m_dGdRxA^Y_|{Y|j&4eh+SsU!Zl!FaJE6HoB*No4ic^ zMnC<<<66|hJ#T`)Cf3P&^c(f7v0{PxDQix|?Br+AXvi7~&4hAiOgDJ?JttYBN7deF zSiUknV+z8_%H<8uynOu|H5Kmm+xB*}m!JRg^)H|P9%kRO!^5+qqZ75{sLa0UNb~K5PBRCts>*s#s~t0@u5I`FhMZE-2azf zp~}g7j2YQ|^A>n z>7lcOnwugPpF?K~U63{t2MZ;JwKU0y#phlS?a8@demMV_wv2OOv;(_#iUazU`Xp{6 zXwfK>V1y~53c=TM~?uVmn4}MwZd**2y3{U%DEYdE=H;laI zJM?J+(^LE;a>j9ufk`WEQQ*{=HlKfpKWqH%vdfC_og_YM#M_YPJB?MrU1>-Eb^5TD zgR>kPah79TY;^L0)43zFjz%JuLtl7O*DnPBdH6AQ?i}~l<`&?zq}uc^tR^n(dca%Q zq7Qv~7SCs}O9B>76*gasO%!v^ogekG4Pr|^XBL+nd~GPsA2Hoi>oca^J&D2 zI#gx|Uu@og^Yw=g5l`JF=jv1gs!WCN!Xe_ryv({_PX8Uy=NZ|r)*kv2nPtZTtL-10 zRfTqmgVx?3{X;8`T|2u9boAQDHua{W1-z^`+Xdj2fgfMZ>MX<2kdzclhLu;J#eS;2 z@q9KSAHgX-ba0;U$HQk!5@Jd7L-~Lbf;zCj^uLlTpb~_>|B+mzCH;fZ-;SRFW)Cj=D*$@1vQz6Eml^kMmSh)kznImSl9-ZyBg)GyJ#i!uBzm1aqJb|Kgw7@!;a zjpJAN^e~;Jib<;4g7G~N?d&I41be7}4z)t?BYT+LjVX1obBIyhfewLtJ9G&{#scaK zM#=)DD^4{8`m-BAXR%f9@j~N^v2m5)X`lZ=dmOV}Nb?IpxhtanJfOF5{zlQ7a?8&6 z+WtJ|oBQ&iZ|ccMPKD}@X8ZzOwKb7-mj2MIoT0%3EIS7X(jnKua6pIQ^t=}ulLDS} zh6c~nC^aJbGr|M5KmFK$*VzpZ`^E4#RWwA?Bd1J<4fG{wdkY{djrqoTj1{yj4VdwU zPCWjGp6>ozt{aM2z7g9Ee67WyB-8aw#hG#hV;e;_YP(ep2sks;Sx?SV0;bUf=m{5T&kYa8yGe+>_hq# z<}!u3OkpmuViMA0#bkz47|vmM9>X}CeG@AZ7^dU=^jML}cs4vP7V-=N=5k7&|1j`; z)GJmLaQa5nJyz8Fp9gHB#T5T!wN22&3G;28yPln3fW>2coFPl3i~;IfFR_L1T+|uEf%RLf-(ws6WA^Z zY?lPqOaf~r0ebjMB(NS5pobKZz19bBWD~| zVv&C)a-KxalgN1zIZq>S{Cz4s7WO#l#aE()_zRAkqlt`igZ9^&QJLJFka3P>#?g{4hlX;UC4 zrR4Y@2F!(=De%uCz$}*?2%&Dx0RJKSO=Skx{X`CmG z^Q3W}G|rQbJi9U9PVF(B^Q3d0blCbuq)?BPj#|GCm=C+BV_m^vzyh@TboR+~P|L%9 z>eM#V*(cLMnNr9nGtkNk07=6cXk~;`+sptLg0cQf0gGUf4Cs&`wXY1Uo*`JxDb&g` z#0K!q5Y*N((4vVN`9lU;8By5JIR^-`JQ+%&_sd{OG8AT@fJag()?@~BcsF+QBOPY4 zeloc(nOruLZIQ`!$z%$d@S-^EZAZGwLR|&{Nn=^8u`JeD7FMlILP{Qb(JZ_l4g)M; zya-&fP&U4*I?n@cWW0eP#iks#R1RAz2bLl_)CzJ?Yoazl5bd{I=QSjw=%|7YOUj8m)66IAOw z$WR2>3z_p!YvQt>^9&F~eZ3+NvJsS&6ZIvWVr3pAq!eoPd5{nkP}AM;C$d*Q%bCyi z%4dt`v&Hiv=S#So4mtB7;UFOOrTJ)0p94~lnlGpw<-4{wWEBtPCg{0Jk+D+ zvxNC9VLl{89+ohlCCrC}ltLECXN%-R!a;oBMXhNGw~i%{kZ|(JB`o0*_|jqE=?tkY zEMYAz0e33fPwCu~FJY@KK^r_@Ea9Gf3EOT7+90KnW|n|2O2HEjVz`j}lozUF@f~=DQ$acOc zV4W1OP6{9!rI1bvAR8oMs}(>eJ=i&g{BtQ}+X_hSbSc+*Dc5=_sO5>J9J7{!4&fB7 zmU11Javh6Ut3|BOB2kRDIYn4^I}Naoaq{*eZtq2`w<2!oMW7ZZia_T$%8(4j%)OW` zQp^@9My)?bdObX$nEjy`QXxO6Z573!Ly&r#5~fhX6iS#v2~#K$mC#`cmn}iPC?`=U zVG1Qop@d~9VLGe0E~~gMt2qBE$XqT~L0W<&Z7K6AWnQJstCV?_vYe$D_nt%^^4?PB zRm!|dnO7-uDFcPAq6|7e4oE#)8SH)%unf|c!R{vjs~A>uI`zh7Y>_f?lG0)8a#04^ zZULmes0o-EU(4E9%i37W`PXs&b)0`4 z@_&YR;PuenI+P-ubhwU7t>aSbxKuSt4T@@%B1nBvHTzOEm#t2wb<$$a4WLyg$nFd(Nu!`YY?1@kd zeM|==->&7pqE^)SzW~00^VH#4s1|!rQrUW@*1)ilVH09dEp{r510;W_<=WLk=37K9 zq$NmpujM+{ssbvdmI7{IEp1>eZ9wldNo-(?Y(UvKtQjHS-T(@5bPsqP*R&4#38&|# zI`BFy>NpD2p_EtDasOY3QiN07uLIx1ke)nkBkOh}q@4tud|)Fu4vLMe;f>%(IB9qz zYq%bz=AzCteyc}W!pSS@*_!oe7bk$1LT~k~y?WL_J)}Z@mZzR2sb>w;Ly|$vdXd!{ zm}UcL5>7N5m}UdhY+#zC!6C;c~p=5f+E@J&o}6KE1nwcf_W4bqRxUQN&u;=X!fE`l ziK)3o5^}nEHpY$Tti!PU^wjXdMJsF{BZN8$CS1)eLF& z#*NxhN*&XrIUF}yJwckoadR){=3dS%j!;hS$J~mZN!^Ng_44?k7ZMHvr`dpB$hj4e zo(FsRd9W99QpytOwij~F1zgHGi#ZQT)ho&wRxqq&SjBKHLwern73&$&IIR~l6EAw+ z=|z9F8?b?4Bf}=ts26*RP#zjr_p;2rEOQ@wP9IyRk3FZ4t<%TW>BCb3My32@*9Z9z z1E=|=K5%&+kY<+p(6b!}B(Lb>nWa9SS?a@B1R6qOsAje>|^=&vE=($+I?JV zA4Z#52B-;Ub0!oW7XxM21PeFOU;+Er2NuQyHc)Oy~R= zjAx4Tktd6Bcm;4g^8w~E%oASV`3y0B2VTJWmoi>VqZY&?%2UpG1;aHAD;ZWXT+47B z!}Sbn8E#-YbxdI+r_?jvz!32Wl$*pYfSVZaV{Pp8W4sIRAbI*pX6Wr2z(|&VFXcp3 zf>ek~URVyZ!GNp$PXN~XPXcc6e+F15!T>S)RhanqUjxsM#n=mbfic9q2XOR4fN0%- z1^yzyVw&H?*puLDhHJn@BF<9TT29%3CpSs+#(-$Kfar4o8~H9;7Vu4+r;khRWD0w6 zm*%&31H$6m^U{+cEDi{Z1H$5fus9$r4hV|_!s39iI3O$z2#W*4;()L?AS@0Divz;q zfUr0qEDi{Z1H$5fus9$r4hV|_!s39iI3O$z2#W*4;()L?AS@0Divz;qfUr0qX-0!) z2*Tokus9$r4hV|_!s39iI3O$z2#W*4;()L?AS@0Diz|(64IH*s8rd3M=*a3)$ z28f6Th=>M=hz5v=21wo&Nf8YY<90xd+W`^LR3t?-6-m(nka$H=L<2-b14KjvL_`Bb zL<7VOCm{KJ6h$;ZL^MD|G(bc&K$0qoA{rnf8XzJXAR-zdA{rnf8XzJXAR-zdA{rnf z8X&ccC`e8a5e*O#4G<9x5D`s9vCL5%(T;G>e1v=EBiu6|LE9}CM__Y;=#AkM7!v|w zoCApY2S7w0KtvxvL?1wmNo1s%pZnM->XT&@^~r#UJAinv0Z2Kcs85zr)F%T{AHJ9S z@Vy+Z_Hs|YmwWQP+>`I+o_sI&D zyqWUQi~&K)Lvsb?fRu;k2afamvBfHk-jVUYOh6NtSPMog4C$Z3O3;-7T*La1V7iXI zID)u=J$VABJYl8b6ww~YA11ydF2fr(scWDUC7x#703Ie@VcZ7XhHn`tj~(~~@h8S7 z0FMywFphO`Vw?ChfJ-q;dn|w>zw8U(nph^C0bIx1tRQZPOnFxz-G+UB-wfar#d#9% z_`r9f2$Q?zmjOINBx*kl;F0pa0Ix8}6J;|vJskMAj7^M3kj%#Aj7I^VY;py>4H+$MU9UVIsB}b>HrsgF_ zuW-Agt6i;a-Cfbu&Mv2So3o|RvCZZ1Mi+UVj`ptTl^%CX{syPF%jM~a&Pq;A4aK8Z z_jEX;)3OplEiKb5XqHQ&ay4zPuIMeEj_&B~j;`ot5bSogME7*LI$EPkkX%S99xupd zM{n_Z+M`P$Nm7NU)zzE~K}Dr-idH<}IYl=+FLwrc+#3Hp4PVd%!pgpa< zs67jKKolb1Hf-?WK&fa^#AO|D+b;aNAAc3N)5ED9_*Em?u=!~_7Uy;0N-60Gk7@Wz z2EGE10d8Eqpx26=-Asj~>B65Ed`Jq)`Au9`g0dU=@)0zsR2Qh3ys}U>75~33JsRPs z2U0n~Aq{~!5m!^b%yAq;Yng;5ZSq@z+^r}}^&|aJEt-+m1r2m?P0U)jpv`Ep9e2H` zV>IqYLs|!Nkj}lp-C_r)cYvN7v|8}X4Z7QbdqI=(l8kh(8~-Ua8j$2AUX;I^HErhG zj)4o=gLqQ<_`5`zG;4AlPty&3nARe#7mG_!p6o$2Bs+OnU&PO(LE0t@dyp?0xg1=R z&78Xh+^LS_4V!^e?MM<2AbEpHlYGe;sA(75dP7JGX^N;cvlQJ-C7M&H<}K`rRA=%M z@}F*aT0VwhDWFLIlfiWdIBfyH4%|%!CF1-|{xrT8J>YIyq!U-FFHv$pd#3(8NQ(|o zr5cgFsC5MIlXl3Cq;bkg_8?sbB{F@1Jb~&(Er2XT9ut(K0~AQRrdG)sLCuoKZH9iy zBgiHs8?^+|4V56@AkQMX$cM~!Nwza3aq%7EOD!{)n!~Z z1G?^H+^lg>il9f5-x6I@ZmJhqAm{<6T{_u&D1A93bp(7VXr*NICN88=kK+MGzEpzV z$t|{u&yn^axUa$=)s5(r{qczuW2H!SBMdW*c zdZC`J=jzM#rFyxZhu$mLAC?m}nTB%ZT;oni;DK}=wuNIHEr%KV2?~Ea?X`CHKUIV@ ziHM_Nj9?%(*%7}HO|kkZ0wV~Fj4;ZXf^ouB%oR?@UKKO3AL_XnE6m0$;~eZpI2VeX zhj060Fyh7&3mW`FJfS4u$s|!E!E`Cy&8FkYBNH84Hl8$c@r03&CyN3+Q7psgVmZ3s zm1qd`W}^gZEXC8sYE-X6tU-0Ept5zCm0b@d(ClR$o*C-#tk8&OgiUzsa)G!ID!EHs zC9cNUS8u^+#wmU$Ud9gEuZkn$Cc}uLDttI|Ap##SMG3zYa*~{k5B8+|mYgc5$?0;2oQbdY&Xu#|Z0troM|>f^l;_F0 zGFr})^JNT<6N{Gh@odBjSLpkZWY6tdeWxI$6zIN!8*E z!_(qj@t)iuvH!2EmkqK}Hpxx$e0hPqP&(vh*^G}3opKAl^=*?bd6C>Io|JCcE<2=0 z{6oAiJHgGN_myMT7F+%BYz-&D1RicmAmA1@_Km#Mt?t+H_AP-U*05dmbYMW>`&#ba<9Bi z-Y$P8?~r%OeR4leIlWu{T;3z^mG{Z}B{Du6bd_?S(2joHds2q@wVVmwj zY+UlVd;;4+KP8`*&&X%xbMkrlYx#nFQT|50B!4S^ClAY)H@)P+_ z`KkPu{7n9b{6F$P<$uY~<-g?@@=JM2j>yw;RQfQJA(T`KPr14>lug;y1T|5Gsc;p6 zXSyggNljK$)VI`BHBC)dGt^9+KzXj3rDm&dt2ydCHCIKedH8ZSM#ZWHDoz{}kE(dJ zQ2a^^iWk))%u78ceuJmiUyEz7m&8jdK`j=~h-X!zN)k`0WbtpDXp^eaRJzK*Q}`V! zQ)Q`am7{W1p2`;P$7i+L#m zA4j*nIKa>uU|4K2bn+#v*eV_7v`~9-Kn$mOwH2EboqP#jH6}=S>lhxk$|4ZfYM~LU zFd%Msn8HT1hWrRG9V;8&Hiqk^n;l-g4Zv2`?Q*v`Z7#mp%K|lV1!_`e*2HD1t}Gz4 z%e<Hr+i7$2C88oUpF8A- zt-@50n=g6=YOlKiY?WsD4zqk^NRfz+kRP^6vwVlC;0{Npr>ooR>1=aq#T~7hv!m5s z6{x%?Q28pe@*ciKR<-qXv^u;!?QTa;ccdrum#x~A!E4G;9l|!k8}h?eZOY&^FYC=x zU3>{&Kc>3yt}#5KCWJslcgPQ0jY+1PFM17`w3|#?YnrsjG-++1Ry~1Q)ta^H;fqo0 z#RHeoLol*7v`&#dp}*|40n_)G*YLVA3B$LC;PoN+jxpTUVAi#lFJTRq?}qhSsNwc> zw04E9AX&_84hyxfDCQ))!^zk1sxG&qtIfncV>tH#>4kYlx2MC?71`o)dYxUaF8&p^ z!rj@1XG+|d=;-itJKau~Bciyo%LT@qJfXNdaK8*~pOYf0+FjI{m_KSmGKW>QJ6p|6 zQ(VYCj+eo_^p(zThq20m#>s+ZiMGTE%iiy(SIi6#Xy27iY+ zEJZ{(Luxbuf|%-|`Y<-F$Gjgb%83S-*Eb`((MpvwTAc1~hdn?`@5K#`Zgz9kh?udJ ztLEmanL@5CR2@C)5|`a$)=%@cd2C%&xio_>S~uz#;IDO}e$DuUIEIH5A3OS7n@S=7=kYU!55=|L)~>6V=77QJ*!&UA}%xzM~1~C!{U)?@yN7zWLi8jEgqQ`k1@SuT0Al>9+?)8 zOp8ahB~`XnBHJpFZI#HjO5|8lAT zk!$hDwRq%OJaR1_xfYLHi$|`-BhTWIXYt6hc;s0;@+=;C7LPoON1nwaXN*da2U<$N zW7ATDchgdXJknBwJknBwJknBwJknBwJknBwJknBw^+-$2GuuQ~uuY_;S-i$%&kClc z=H=SzTD=a8>9(7fIt~Q3?R=S77wi@$ZVzI%dNbn=zHmLz@KbXmdpcS$f7$HuI$Jio zBQNejSfIh8x69dLYj<_f$fV2J?CEHk=)9yE-4}9^tm&y4#pX4qM0dNq4qGQ?NYRfM z_jo-_K07Tv;F#HI8Cg)1*X!Btc5dmmGuG1?##b-RubMYoJli`=Y_q4k&BS^-TRI{F z1zI{bcR9nI7x%cfIo!^UW@nhIquYrJxw|_pbaOX}Ra{)iD#dk0;P=YFwJ309@o~Sz z{9Tk9xCY7<1`dTm#TH?;{I4%D{dujC}Kzm2?-$!B(cu#eeTSVAZz>d>F@XdzdG~!=H7em zxo7!)Ki}ni@0}YVg%B?O7=@U*VE&>DZ1Lv`Ass?oS~qji$t{2Q)6-`QaoIE>G%V)jIo_F@D)t^6M3<>R$X3p1~M}cLR zDU;)k9Os<3cEiTEA1cq`_)Z}##cM7+Yn9w}#lw2!nAL%w02 zVWZ)0!*hlY3_FcBW58HrTx>kw_+yjXRAyRey4v(J(~G8dv(a2?KFxfs`DXL0<~CU8wl3q{Ro1B(BBl)!Cb;&m;Ka~7pN=wR`lp9kXNZFFIKeZxtaq5k!ZE0Fs zAZ=dSU1`sx?M(Y3Jtuue`qk-M()aky{xpAsf3^Qw|F8YqGaMPE84EK0Bje7D7Xq%p znSu3zTLUi!+B3^CFUx!?OUs&-bz|1M*(up8v+vD*F?)NC$nobi=B&uMI_K`37jw4f zid=tgWA4)2jk&kxK9>7-?w+7C7zkDbrv*<5t_+?Z+!(wz_@m&@g1-(v8hk3aDfnja zgJ4^pIj=bH^1K)Go%yHbpP9cV|FZn6^RLT)Aped0Jq7N9s)ADrHWvJ(;HiS`h1SB- z!o`K>6mBfMuJF#nhYFu7swldr*jxOa;*pZHlBSZCCI3-!Psyf|ou#(Y;?jAg>r3x0 zeRqO+LfwQjCtN?_i3!`vw6e0Y6=mNkySwbEvQ1@gmW`C>l(&?xFTbw**X3Kv_f(`* zOskkv@#BhTD%vWYm35U1D>qbLSNZG87b;(`{J3&w)xxT$s)N-x3$sWKb&BdxyI2?M zl_E4G9}4Y}kA+?l7D{)DhR}#OEz~8Jg!YQnY@Z6fBOhnq&UO1lI#eC{lv)E~L8ye)a)PE z=BL!$M$MO~xtp4XP&YM4sX0W=H)yYi_I8O?^s}1%b)0)D^a-J_WmKU+AM>HFdvqEWPlK8IUt#HU>QnYav&eMNM$zgv6< zt}SLPUy}hL$)PSjb!(dYEo zOFILRc6LYFQSut1moR#}IIA=vdiHJ3?$xoln>G}_2Wg{~T2U0w7q$AS^_G$qBk02?Jr(*83AsVHffiHY zjMC@@^nDtd7#{Jb;v0&-ApSFG14xy z@iRvI7e@OAqutDCH=~bXiR_E$<6h?2!Ohn47uuo@V57y}z>VUuf%%h%pOky4rX!k^LTEJYUNGTHKmCRLHwqdRs z}Qq=cj4=m)%iHmyMs2;=s8Yd7c11jn8GttwYG6K$XUyAa48Kg?GQ1{D;3VB zhqk~eC!>9y_WBvib65>4ZFY(+dhfg7*kti3JpW8gg9lZjJM=pJErN5U^f?pGrN|AT zkL6|1M(9dpd_6LLDl{OU);a1CIrMgP>5ZScvh?F;o;3e& z3%uEd zj?~W>!yscwV+=vYkjxnB>Aw)oO4V_vY({wg+pzYZfw?xcZ#R~GKYSSFs+5QnJLzLU zG;&oF)XY4m=-7Lk{*+yLg_gF_Unl*QBE>;ktE067TAM{{K3Z#J-cIJ-fz);qDGbX$ zA-SmZY&w#|*w{^LpU~QVTC>uUvi7mGG=WwU@vx`CrLb-4V=mSBh6X(HMCzUx+AXgL z?WLC<^#4=&3|8vdP`i8qEtgy~pkJ+YLfPUz{b-OQ{25~o*HC}4ja)y#wSBtuKSet4 zA)OB9%^HEDeq_?iIggm5ju_b-y~Iq($?*5!D@G|hw!b)b4UN_p(bpp8Yhq3wv6jAe zGJ=nhLJw!w>eB5;UR{)Sf{Q-J-6kfXjgyhtRA?F;T8X?A4*uCSJ&fsV^gf7OY#?Sg zhynX>ULodG9W}c^&0cX9JY6e z+qWmuin1QfT&*le4Mn2ORo#4J(oXXEGucya7V^Y4pZ z!?q^uM^p@;B8^V^?}GbEkN4>kIKIeLd9I^dw!{eMiGp>`caP)z;5g3r!L#mzIDaIr zE1oGYqda7{j`fA`I0pWv!rO)V=#LLS%D;z4AGSxi$jL`LHMEnD+^fOE|8_KX_!#8a z5xPWLdqGTieX*OPPU6@@%g`qL?>acO4eP05@HTAkZtNg&I5+tKBW7{{iK0Cfh_aBc~|5~#=}Z6m+oCcjZZexrf>hM(L<1G$X^tZOH$lquvaD#%w%CSQ?BzQRwwBIjS^vyRT& z!)w;DJ=*bQ)eJ*>hKv4RU?Zwj+`AlHrnElU@z^Q zMNi|i6&+}eis?I!nyomxCjH|+<@gb3VeE7CXy|a+Lls{he-`Wb7rdGph1-l3A?_piBm;694`GFoiL#I{_;VALoY_?kEhqKv7*NWqp+_Cxmk89Zf zX4@V-LM9R{!xMP%1X*~3NqB-(Ji#P9K@wh|E)tC&_I>~!q6`nwjEC^yA-s49Hy%P| zR}SX+*d2tUpS3drJH6ZKIpJvS&}$qy5tF_`4lwp4t}J2f4z4a?>=s%mKWYnC;nf~z z{7;abc~UqSyH)pYN4C<(kBGxZ9LHxdzAW*55evVM*{J+_h*j1)z9sIjr&%(R&o( zI~e~shiz~)4sOOBm5Yy~Zz?JX9<7#MWBO5RIA~)gJzD9}itJoRtBu?oN4bM{eCSL7 zd*p7(VyMxlVn5P3nn%kEh%8Sdf35D6t!8^RxyyCrjlV&Lk{my_qL>lXft(cd%?EPQ zRaR4PEt%HxXe}$!S}d)V&{_?xrO;Xpt;Nw=^q$)&_uEXgSW1f%X)&D^Q)n?jzGA$` zKfXEH=`EJt;^`@#@utGXtyr*w?kLh*484WrcJzCj(fc<0nbk79&_ABzR`*=~=b7?< zx6)7E{m?rI|K`i#`9f5PP9NzW*#E7w$Ib-*Yig*N`N;Qd|9y7+9qglXo2R8O3)<1(EfB!Q=|8HKQGEc{M*Zco&P37;7o^$>Co+SDEY9IgH zkDReGqv_e;u#l%1Qh17?o@}v$CmBlgr=Qd_MT6{3WK}*1>!9v`s3#27b2#crvP`aW zb5$8vsVB*DumjyZ_qFHmsA-|Su1I_8sYvzQNfGV2Y0pMZ!a!@QbTsUsmU_~zIP%2B zL~6xTYXZIQqSr36Jt{wR=u=rU$#niJdQtotr2lrZGV1BRKC<`@JdhXiL6dkob{VuBS^=E_t%TO_ zobFm^9dsdd4R-2V(6!Kap&KZ>5!w{mCSQVHhF*bQWh_~ugh;Q9UmDb+8FlQ}^UI25 zp||MeEqZy2Uf!aYw;7b7*reZ7w7~wg_4bE$2Gy zhd7V@3psZYbTM=ZW4em+YuH}LwKq_96ZC!B_z~ONpxdFJFy1>U`ziZ(L3cy0NsiSoUj9J)PqTf7G*{wv!L zp^u=g)cF|t1lq}Q7u3yuAN2>=A7nekb{}P5@JzP`86YQ~Hx6<^@sJxzfD$1O9i0lB79U!tp{wKecL8j=+PIP4_zmOY|kA(KiN1;uj?Vxo#Xx$E4w}aO0 z;w8{J09pq?>!5Ig3Kv^9zv%H%mJFpK9Y2&oSr*%DC0im4;4U#P!UuNmC#Np z{%QhL#?$)cY%7r%90S2^=;vFY_H$4>0BXBHZ5OER0=1){b`;chf!YC3I{;z_#Mfx= z>(Eu4yN2xzl-)>MH?h5$vhUN@kJ!JJvfJ3+4&6cdos{3j{x2xMo9!Ab0=-4}jhQ(EB;){T$>DfZRclJHQI{bMYSZA^RUeTiO2@ z`UKj^aVKqevF+x#7wY4>0geZuA!r|EUm!&dG7ym^@hi1tCnLa)1+Al?briIYg4R*cItp4xLF=e24(*dAP$@J4Dx<6%s(>n?DySN& zfoh>Ts2<|}1Lz$Ey`vy^6y%PA+)M z&k1H+Y~v|&Ga9_9NMb*kZ3^WXq0dBs<4n9mDcG9;VXg2SFQ9uPc#my(jMv0WW`oS| z9Iv5+pP_?Y=wKf@*oO}Gi50YQ9@`5kU(fzUY_Txt;cj%V8?W)2xSsLdK>3Y~=_a<{ zr=1^C_9OOh;hI}1zm5GLvwu6=pK#rs)cGmx{G57sQT7Y!+|BkL%I~G@KK6gZ_I|bx zaPC324?(}>+DEAKC~ZB)F)JAKvkOntji>2APj{oIU3i*q@hsOr&;AS4f06w^v)x4f zSD@E8{};+ObN)?^-{$xo_TOduSK8SEPv3(+pw5Sse*|si`j4ScpbpA+Qr5}Xc5!_d z``wiHa!ns?^mBfIvO&f(#C9L&{zknoScz(of!_)_iCE$w7ZeYPHrMHl+eg+72A&@=*)6nfqOIX%Q2`@sJo2-*yC zHiMiIP%#1;HY5EJq&tFiN08Kc35>wq5jZ&lCr9Aq2wWS1J0ozT2X6Gh zjUKqs12=l$Mi1QRfg3$=qX%yEFw-~ib^Gvj`|x%9@OAr`#b#!)nOW>$7CX?RLG)-4 zJsL!h2GOHIaW{IzuVRT@t!y3S4Pto~)XBb!Z9H2yv+{8s+lwBxNA#!zJsM*6z39;} zdNhn44a14I(W7Cw(GC|r9H&Pg!i^5}sQn;ch82kTv3B%m2t8_tW4-86C;qG-f7Xva z?Sz9LqEAEUQ#<-Jgg&*y(GK)!2z_ctpN7z_DG}(5In@J`JHy?da1G`m_^$YLDnsFZ#3(ecFdU4WUo%=upb`aDKg4#h)I|yn=pN7$=Vf1MjeHuoehS8^C^l2D<8b+UnLD}2r z(=hrpj6MycPs8ZbF#0r%J`JN!!|0Q;;QP?0edyCZ^hqJ{Ly-6(NZbYzx1mqN=+iLz z)Qqff))TOg5Nfinv`*mv**YAmyHf&dp=H<=}cLWMv)J*evib-kdj7sU1HQ4^jS zl#NDE_6gSd6Rh{KEtT$kDzK4RPEPMbt`=b}j5F;R@1B85vY_`937yhvfT^dM{G%Me4msy%(wX zBK2OR-iy?Gk$UeDBbE(30edNQ8MG1lEp;D;#-!hiZ5qWkjbfWdu}!1crcrW5^~4^V zpqHSRp;w?+@ht^pF=Mbctyr2)-sTWXE;I#;^D=h#Wh~5AWWN>JZ$n7IdNoooGQPTF{9WbfN{FXhA0kZXl1c!#mhH(Z??12+|;KUv{vFETg9ioge)N^(j{V#`BKxaTJp-q&(1icKs0=-I0 zUq@5-qN%)JgQHkHAKnQK?L$L%qoMp>9jTO1R*KJ`0G07e-Ey{-l+_{;wYHf{y$hj> zplc||)(?Ss%m(8HX2 zjO`Q9)6lb=f1d4&Y}E{2hyKF;X3E}T|84qzhy5+g;XUXB&V9)7M^Fd*JK1(Yy`1Z# zZa-xM91lTXa2$d&0@CorNyIV95b-A3)QvWEqfI?%QxDqIgEsY`P2FfyH`>&VHg%&- z-Dp!c+SH9Ub)!w)NaH=E@gCB64{5xIG~Of5?;+0bA;;{s@_Uey%n3>hZgpsg?(sYA6nRr7IveByRpH$vBBL)`_LHwW~AMNwA+Xf zl(gHBb{mnw9wgq6#M_7r_8@icNg&}2@-G37Gr1-zeI@w{Y;Yyqsv-MS&$FO&s5h5u zR#2B!2;P4WNNB_R_ke~r(9i=K+CW1ao_-f-=m8CFc=|mcq75&<2UN60y!{~NaVvwaYH2nt8byYTLNKuH_keGf=!i+J}Q5Yra%>^-2S4bQ#{ z)qAQu!5xuFCo5%NG@$Oj!B zg}XuFZcw-z6z;~>eR5n#+(5qlQs^>hBXk3Ac(@T7Lr@zCY6~NXw~@UBy$rnqy^5@V z0D=ZVP-i5@90EnVK+!HezQpQAV#`htv=;>R>ak@h+?W8Baeum;Z3SzyO1652k0);H zxwC*r0!5vmXb2Q_f+7_|b`n1hfudcYNaaB~K~X0t>IFrEpr})i7jI)5juksW(Ox{f ziW3JxP$vlL1VOzZXb=Q-f}lYV)Cqz*K~N_M+DioA8;K7)Bk^G;2-=IM9|A$0AZRak zXAlH+f}mayGzfxv$Hj(wu|b0%s5259?gBxbAZRbB83Z+*pr#Yl^n#jRP}2))20=|H zs8O+CC#dNKF}pyF%A0f&2M&RnPEgYui34|mnq7GLA&_%?*}o(toD8Kvyo&())sOw^ z2RZ#9ryu0>gPd(3rym>Ej}7a`hV^5^`mtgC*sy+VSU)zbA5Ut(k_s+3ncYpi~6xeogk?bB=zG_Q$bQHNJ<4ssURtp_gIkK!JF&>4GIbS z@h1C39ag!XxMn)`Wj1s%b*^LkQ?|c{{z^RIB)=C2xuAH+4JAN{kO%TYIzZ9L0*N^;H*o(1i|kF>7T-yP5g1tY~kOo~t@nJAN493+eZuF2`!3~t%NZTiY(SG5e^;opZ1^GC}9`O4^AGUcv z_SnHFUSJfR*x&uw-+pXwKX$htySoqE^?^CHn(7DjKJ2bqO{tYsKOVbZ+(Fr$l-~!FR}lLr!^v(|DVfCLDR8t8j_$#4Wx~}x{JJEQ-)khp-EO$s z4R^D!U;D|J43K$L>jK5u?t|7cXHZ|QXD+1tA_&{VTDF6=Y=^j-_O7Ab>$vU)&fNsv zOq)MqdmD5+bO*k zH=xZNzfFJdu>BDF2-?ONK83bJ;pa^66!pZ22wd+agO|EAp_l`{j4o|1SH?6|L!pR^9(==PZBsn zFA66s!%NuS$o5v~7tjOHA1Lc&I~aPA)?XAd>DT(5-&m2O%`xN{eqa>Fb>} z{2R9SvwaYH2>LD8K1`iQsPic8{f>D)M)~9HKf(4%&a1b!{gJUg&G9oFKT8|Wv;P9u zyvY8a*>0l#OI-Uh^uNy5 zKBT`N3HLpptjM+CBi z2xJEl$POZq9jyI!{GIpZ4}MZ$1DbLvbQ!b}!cxd@LEnb1B@^=PH*M(Rz`1S z^j1!9<@8oYZ{_q>MsH>GR!(o_^j1!9<@8ogZ)Nn>KyMB7mP~Ku^p;F-<@8ogZ{^~f za54ca@)13z&|?C&inpkd8I0rD#nz4GPh{WAIUn_sA+@Sb!{VxywTgbHlNFrF{w!!V z`{9-JM|g^D)FQW6Yvz<@Dv|mNj}me;!EgDd5g>GLwSrV*j`Ov*U;~Ev~vUX zZh~&6FSX+S5&O46w?jW+40lj|C*>-tzKgQEpOai6M>zL8 z#_||tPe9@OQKQ)5Hn^IA1^Gx{X+O_at+Le$`z6X>hF+tMH`s3G+}n)t9k${7Q0k6i zI4=BY4Z#UQcXds z>b-+0NHzg$@F~(wzzTed&rtVE502xm;pww)LEmPLa;*s9q1usrDv}T2q1v$&A7Lpz z0tE@6AVFLS3V6m1`xk>;ZOGbzy^ZBgSRBVLw#temvhSsyk9x^a3O+Lpyk=lM!YJ4Q z3VK07FDTdn3VQG(TS38_px{kV@FpnmfPyzc!B$YPHG+a2pkO-)*pBqmkp5>#e+Sav ziuAW4{Zyo{axGht{#K;F73udO{Zypi6OsN_q`wvEry_loW7&%Iw<7(mNPjER??d{j zNWTZ^dy)QDq`wvE_v!1gKhWPF8Qas8Jww^^Y}MNU{|voE{g*lS8s%@W-ORbS8RI)_ z-=&PT+yRUEA!Q#yTeyEVDl(9K29oz9`D`S=1Ihc5d^VEbf#kO$ z`K?Iai{!oH7eo@gNfZxbMgQ!q)g8ReG8XUWWJE5u@sukY;G<3w`^jums6$2`$+r?U zbRhk$tO*BM6ArQ_9ArH>L@fS3Xy^tF-5{YAB(#ErEg)eFNZ3Mj(E$>+fP_|}iw@Ax z3L3T&BYglGc3=~FLBtMhf?7AeN3@}ydTJ$p`V3UG;=g)9MJo|U8^~xS;^-i*`V54$ z5_NQdl2%ai0Y0u5l(d49twbGd*a;PTeFj=u@qN9ZrIpB|4aBq(d9;BV6_M+fL>1w9{to~_u94?s>U$oYWCqYd=5f}U0)k2Vn0O61W& z#LsI8GTW*d=4D~M_ZQLP}V6-2cX zRkVSkR^rCbh%7olQ)|S2yhlXQ29i`f`2k331xc+$5FH@rJ$(5PzI+Juya#$dV14mE ztF!l6oxRWM?0r^e@3T64pVis>tj^wNb@o21v-io|4YKAOWX(Cqnsbmf=b$X6of3%W zg;;YA$yt=mf#yOdKqo@;p!pDQSsj#jHsUx^)sS=M%2%U`WcbR_Nd&(UU?&#Dc;Bd#%hV=$+!@wbQ7m^6Q^_&r*spi zbdxRFL$+iO*^)hEOZE_J>?YROO`Op~jL~!0?1;Jtu`|-*PFmbai#us?CoS$g>=kMj zY7MHM7ud}#b~B6J%wjjQ*v%|ip1ty7=o07}IR7nZ6ZKz$UWQ(QUd3~0jw{qkBKAk|`8=PW z#eW?b3GE1V@RyuiXkX}^(DqPksEz&6(Ed;lw2voFkNFAp!EGW!zN)=Fp`D>#R{Mfh zy7)T`mXGmKwN*`ZO}Hu+Q2#{EjOt_3YlX`X{TpqAnrihN`G6(x9r@cAEj`jU-1|X) z_i{aB;cn+~e#T#Y@FoA0HX{5{BhtV7;PU9$e8+mkU+_T^JjVil)IM@hl0o8%)4kZz zgFc~wFb~HHY59%NX8!KwI~00_qd!9fT)i*!SDn-Ej@3T$UR0V~r{uBg(3(1r=^xDL zl2`S{KKgj~hxx~7lstBa&qiA&pYeBp!t?lhE@M5$CxlMH)3>8ng7>#6`;ap|p}&Ow z8$H@Y$>z|Dq1W+e>WcS6TkwAR=P39XFWX^wF^Gf@t37xh)#@JoZ$wi#R@{qV9C`JJ zx{z@vf7`e`ip+1hk5*!?;FhHEoSv8UxlFVPo%NiE~?s&6L(F-Ltd(1Sx%nv|j_KzhfS|$e5;5u6UwWfcj^g zT;Al|I9)%IEjyGS;g-~2)-Q+E{jnN{-vhs6IrGsijs~e8zg!k9dwL#52O!pFQyF74+*b94U?H<9HB$e%YSxJsg+9{i!p$ z9pn1&C-k{~tXt}6*^#zms6u-C$Ia#Q!}X|IIaDr68sQK6GJuXpEG||gg7N5o+nE-Kvgnfx1y^iG{@O?GODRv{i58uyTslrmoVL zsQyKo)aBcOoXJIo9_OiXK4kR1^iense|X+rZzpo}`ItPSH4eAcwVc=>a@984h{`Qm z_9g#&c>BsqBJ$xmnB&v^gJL8#S~Mn#C45S>#qi8I1|xV(Y!5bnTezl*7}Y0w-Pl#^ z9j^^KcpS>=5t&BX#dbuoqH{`(@__e?)Hx{jpiJZ4S_XdmCy2=#cvhfMH1j-HiVj;sG>GS=Q_d1^%Q7O{%zuV_mZR9J}Tgh{oc@b~CYhb36_~qGT<~o(P<mqMJ*|9Ck6N13E^I~lGSd4eDaAJUn7HvCCro<6qukf7YFZw2y5ppN=qB?74k zco@%d0b7I4*BHty9GTeKkc9?k9grEmJ87T*Id0$4*f;tpxReg zg|Ad?ML*%5m5fxIN|NEZsdDwczi?^zOn4Nz`e>B2kME-))$lh4zN@d{uwQNw>R*M1 z!+*_S#TxmJ)ljmGwjABsK$H5~$9)|jEBuWGX@`E5cB`)|@>Mu?v!8a@X=ag&2#8Fu z7yhd%p;U*hd;En~eI|Z*uPn>h$1t{g&|Vz65&njCGFCq;8C52G%3>MeStfron7d$4 zm8hK1u@WL!M~dM~x(wF<2mVzbkx{p&y6muS%6xA6iQ_ z6D?JoQZ>~$qnsNXi#n^guHK5Qt_jx@)HZR(6gj7kjMPb>KP3l6s(p2p`YO4Eznsv| zSZG0=RWnny)!ft-&PZvrb_QpZF6jSplfQ?4l!g5ASIIQ|4Zyu4f8&w4`X0GP(t&g0 zz+Qm1m8CrR8*L*M6h*&LZMGiJx~TSrw^2)>v_XBt`WxoRp)*z5ul|pi`cHuBulo27 zvgC(ebLuCBCzHw=dKdL z3ol;1P847Am38Ncic2nCuc87~Q?;Z>{Z&X%*Q&n;M&@LuetIdTZune9WP7oGjT9e8 zwtJ{eWGFS67%q`%Ldq=m)mxBVXm|jRRZ8sAATOhBH}6~BsBdj@gT76am(sI|ctT@l zTlniH%G1D?B!*INW^N#wTu4-7yt{)p{0X*FQj zV>QEFLOjcWPN$CkS^u?*FCl6Tj2aC)LmHD#2O3yN&``Ioj65a#oKvz@V~@TSm1Cl_oY0Aejzr&#c-qH*2< z2M5y8h)iPqv(Ydq~{GeeLbs+1w_$ zJ1_3yO$s-NopAf-#M#%2HS!Pg3VAgvqx1PcpRMv~`4sO2{sB?7AVU5vf1guKlwTK1 z$C#K0&UQ7s#`*e!mv&;(f6f zKl9(L%zh=lD*j6tjZe_(dC0{C*RN!Ka}%1dNxm+-WWNk)sambJ1Z2LXZ8bdQkM-yJ zr~6O$pXFcc|F-{!{y+Gi_W#Ad!{6^84kQLr0{%c&AQ&hMGz6ycAA`RZ_-^2V%s^&V z=Hkp1S?(-PR`Sq)j~aPjxkBh&dQUIPm*g(lCr7lTNKc!z_vp#t&+$+5FZG}4U*o^p z{{#Q;{ZIK{^|$%=`u7JC0!e|iKtS)QUhio`;OaxUs%5of7>p^=Ra4+NBV4Q{&el9YlPUg`qK^U*MFM9H+kD%w%xi-*R@X`{N&+J zz7q30u9xCGnWNg#$U$izE7A^RJ+yX?d$c{;UTr`d()ROTu8jt>!D_G>Tn4uxG2Fkw z72Y2F7Z;~ROO!gJ!T(>@w;5u-(iZtW^x+(I=6h(%ll-#jT=@4i>&rjL=j8Y0573{b z;w$o-Vk1`i_u>k9pZpaz{v`Cm1z%_FNS2cxJYJ^%P100$O+;P zvQ!Mp5^;$vW(CdDO|n8tSub|WiM;)$LF|`RVpvwArB{ionvulz6hYk9wXfGA*#vUqX>QOCcnR@5jQvi-N!`lm+;|F&BHwp#xTt3?>V zJBwy&=M%B#65CoI&kMSQmQy4vyq-j-(c(0C60pWJc z*Y8Tn@x&w-He|+5oU>?7ox>gL@TyFW#TD8{3I-^R|H`gRdgNDbIGIp|A8VuTe zCYCrEKO^RwSm?M#b1+wm(&F5zU{zX5yp#8M=2#p>rpP?1t7;m+qri%&9#Q|ng z#M-~kj`$2s%p-QPiW}!6rNqffnhx1Ksi3i5Nh()?ESQ~T)}d$C#e-b5+M3#fClr;S zAyTDAUTUzIjLA7=6HS`gY>J81MP_lhVx-X!8=0Sfc3ojpL83V(2K<<8F@Zq7H%4BO zIjg10ky5a9u4nFvlPnIal9_k@_ujk9Ycw$3c=wqt6+w5=^h(#f)oV-a4zuR)W_oO- z{WQVOD0v+mmgN;Q`Vx})_(oMjJb1W)F6Sp+DV?4 zrsAe)zKVL~fhB8IAwOYUwPM8+1(_N#UPO^ngd~WUVzt7NfdLu}&dEw`ls5UJCmFnR zvZ`U659pYTUSUbIOA`}Ha0 z%k;!J(~AA6Wx2{k=yxqTu^*`-x!H>xoRfha>+ojMsyu%oQw)xx%CMGbUor;SH;vbF zwQsaIVx%?pK#yLFBPq)h*Ld#jYaG@vp9}b%M!c@K8O>=9vM&*>RlTC6Qn>h4k<6i2 zpKeEuV`n=V<(7vtx0eP=~vZ^v*Fc_7<^RS$`2V`n8*(X~q8t3NIkrAp{#2d%jRr-qFSxm;x#Ip44?pq zVyUd~U~{uE0~WKv;k3J)c8kT)ID6J~gE_`jO@2w5;?jH;w>#dFUKlWZ#bwmeOXSak zb6TpLDe+dD)sNzPzoa2QE5==v%k(4QQySq*Y|^TgVT-!k@h2-Q zYVzQzu2{O^mg|#e)f7xCOHHg^Hp^d>k$|zmdX`pA&`egF!(z#5S~a73epRX~CBqr- zO3VqiR4-O`JU2JD5IcTZNl{AO$rH;iSUNG*>yMZ5UXQ_6)M%|=u02e zPePhICNVj2)pxSWsuCJ2^J{D4D#{hsHJ&?f(QREm8Lw}KS!XjyBhR`UOp3MYK!y(@ zoK3fYGuGHQkcusH8fnwjK&;VXGycSut186vVyw8x~zaN(Pk0(GT(~f zsqp%64F|Xv^%ga?Q6|^;4)%D7^#v^xQm(o^8%E^@ za}>L@vhrM0a!O)xVN9TY$+w@pJU!z23MQmZT;B4Fd%hj4ZS+oWES)sjU9bDS0NAU< z_RJPjnwwfcT%|PegG7S~wodz?ZnP$qa zXv$2VSmsa9%f$#<9Ck;n)ojo(*;;HulEYj*|BO{jGiRP!9&h(%`I6F{MtiJ1p?G$! z!m%Hp-HgqyBs>1SFplFgybLrB{FWmo17IFsq9hnaG|-KmtPne<@nXI~0UUF$5dG!z z1_KeP$t1A3dL0m5T_we&iB(gpr&NPx@4QA7n_<|H5r2dmXi znUG~xegpeZT~(@W%bQu9VNJ}bJ+Z1{l2tPrjG8oRW~+{DBT+d4p47}vaF813o*k$x zx41KsiWDk=hAE>;mw#iH{sx^VeayTfXUPxl4+7n)1v zrc~r7Enb>DA%|O4D(;yH56j4fH;UhfdFUw2$ujUHgp|592p<~4hY{`tU|iVL>KxP6 zT`m9$2Ta1;hs*I?1SnaT5Ws{-D*3v<|Qz^v_y)Us*=Xi#{67g zVvL1<^j91eMcN-0gA2mg+iVPEo_@yZ}#bY$*HZH2Hm|2`Sr8ds)NKM4W7%mAr_oeNTI=VY zUGdz9GvS0C1aaSjyHk=Glep$^t};bf86l@G`CU$y<}8Y@s?mdO#@ix_?JnQa&w(9O}%QwPwv*zzk!PtkB1F!cnVo+q`Lhzne>QW$HzgIIJG%&pi)>zPyMp7Uh-s4o-){G_puFj z!r0tq8Vtu_yIoP4u+TOf-G*z~(Mhw`#FiVe<&9!l#0q7w;H)dQsXG;zaYyu!(x?rO z*KIUXO`Hr+!gkv;R)#dO*kN1!cyUvG4h||;HxnvXAP-|FBCApCb$Fd)w)hR2(dNzc zrB+u}ry8wcE5Tw@GZJ@L!$QtaiZK{1hPz_ojP?{?-0~HLC)8)1Wby}+a+*%As6MAm znTgyaM@reetN(PZ9{UI4Z4;(0F8zVkoR*vCNN>)cFt0JFfUee|ayRz4N_=JR!!~6? z(R*n!F5?`L$C**XkVrlOtf+iKBTda;$n(26Nlvx*aQC(fEN(Pj7Mq@<*~W9=$R&Z(c_^k#VMhNcsfZQh!t(~@V* znca|+R8W&q+FXjVbH{t)O|CR=dSQw~KAs#b^~n6(#DI=p8~A;axz#EB#_9N# zC^mO#a9>8#naC|1L5*7?s1+HjTUE`t`l$7E{1z1ibJ9}cVl5_7C+onkzU~TpGKEwX zRVkq!9DJ%E%c#7dbf3JSw#sQU*nOU~tnBKh>g;pQNt@kLVu|y_ITBOzGn4ZI<@M!( zf+-8NvZ+87K`AyR4@OYBr4UWXP zin8pa;Dq8}jMd>>;z@NoOzA~_x6LTs&eADGK9gh-6cck*;lkw?&UD6TjwDa~39HUu zF_W}y96{jfn^x9m*foob5GKV^IC1987DUBZaj=F)#(Ij#ZVt3$sce#LGO8QHD%+wD z_k=n1wWURk^(H4{HXU}%a$L-nR|?GV&Mb-j1|Jth_D$N9*o4>^lCWBQQtX7%Om|vN zZkEFumoPCc$LlcIyfLQOIG595G{re*q~xZ?8*6Lb&Y~vrvdqq6aKza#xDI1^MoppL ztPxRKY!}R4yP%;YJHhTSIFh}t$qSdCzR>S>sMTHN1DAT|oU-)9TC2^ZSg_>-Ym8G( z-+9W~^?6NmDuPw>rX(5T(vvODl+t+{!u+s@2DLa%Jwvm0?!zfyH>MyZmS=L{N@{eU z{2MW_kCU;mi-m54QK{i8;=_eu*Ap?#)@-#X`^sdP7%$`lS-t~qE@cRQRC?xY&T0}wSqNUgjvOW5g%e=G3YinH#OE&mrp1v$PMPY zt*)Y46)`L0saznMs$%F!hD^D{u!+@I9-J!Ga>I^NE$Hoc|4hoHpeMy;GiuJbbJFWi zslRZw$zpQ*+>X=BNk> zf}~}O?e&xE?8zRh(dsP?CY2UsS2+Wfw_4-V5`AuGIzey5hZ;^{-mAr_&2ibO3Gsvk zCzg@EW*rv}syr6mw-`un6X}|bVPUGfFX~vG40~Fli^#bp&9}ZN7BCRZG+sJNuN`ZT9Kb-&X`k|QD2yB zwvv}RknJ~^SRr}*DZvz%K?5ZRPT<2m{?uS{++(GSGQQ-Ixp7kyv?b;F8%kmWwFMbV zzj9$^^fo|jSzTjg(43N=)wr+>M;|RuJaN(7_>}zosp>f^)@JCt%jj)ATy0e@n=%_?}LL|;RwRO*40Y9`uYQ8!6ge6a_*V(kW*-Mpgd zsc05eo?^z*Cm2eno|LzRT{5Zmn$(Ip7oBdgl&Z|B*;s~J$H`UVyg7PIQjL6Ox1JeYDsuNL&HjW$2d(qNd3mN?jTi*^tF|~@Cm|-wmC;D@5(Er|Iv9KT34aJlH(s>eSPDfM>jYwpHGS~Xhyoq7f7{?7N zV!S-8mBYe0Fp%21BANNvm%A=1G+9kwltg+psCRj2HQF2SriSM{XEsl3kVaD`aZX7w z5g*A!>=Ld_Q>*w!td5*-L+HH%*= z)iY$7Qb9&TnSajZ+4exZ zJtsXQ=&=+m;}%08*`LF1g+0|4mtO3T$!t7h){^t;eO6bZ-DET-mrg56sw~a6x);@# zo-`>()))-Gw7XL?ow?j&PMJ}_-O?0CMhVZDX*xf?s%;j25V}+?_Kl((P8gMSQtsBL z-xpO&IXm~PSgaqor=flUfW#uny7+_6E@_SpWEACRR0b;QGMRc&g5rqoF2hM7{g$v| zSAw2~*F!|5a(=l?+D+5GnsxFeGyRzhzjuE5Neuy#kVY%F75`K>HOFC3Ez7ZIC6Q#d z5=m)KS}ieIvo2n6(j6OT8x!-hW2!Lbt8LEf|O%^^ANR=nFl+| zaXO)o3tXP6y-7Z5p6(W&tjlMa&4Mdc-{WpXbcLq>%&!2}fx)K9?h7%k*~UA2KcuhnGA zI%Ar_9vf$g&GLKBTNPhiT$q_S#hRStp0MzumgFzKuv$uro%JU!D_gmKN`^B|C0Kmt zHWyxTx-r%flbToHOuuAq`qb%DDgzOj7*0nfXNa8U%zE{!5@s8oB~C;a#i@&DPOB^n zq!*ZCxhJObiOR9(l^XJRmLd|K>E5r&L|CR~X7n{#2ofTbj0W_&fz=+gCi?@Kfmma5 zYJ5(H&m5PUk{qj{|C%K_TOenEo2KjYDgueDtz6zXo7Lv@xHMbrojMa@Vq&<*ptFZt zL?j74NhdBl_sk`k))*rTgvxLH$2TgS)0Uoh*2$@US4pv>e%|u3DW^8%q$MXDMZ{EF&`m+o?rSB@$2CvBkoOweQF6{@{!oq<32r1GFn)a$^L@;n5xq! z(4s3MZL`&+N!NnR!c>l%9lH3=(xO&Z&HF1&Iov?a( zc~V?lN~XJM>9mT%Jm17`e05!MOl)$FFZtZ7zq{cii$0qc3JNE@5$ON&@( zXRDaFe08HLzpj8ARY~!@&MtVsRe@$DbY)zl%j@i{JOvT5 z`D`#M5yN{&7|CJT+Ds`;O%2}WW%a2UE$7WD@;edchS-2xGn?Yl9oa=m*1VG9*!p?P z$|jyXsURaI&T8Rd-i(QhYbLH;ToLnoMBZS~3OBYG4Vm1}D=LZF(-!8Y?tiRrb~V(J zMJ`I!45l(}%^D&hUn+TeB0$5b2kv!@Me(W4>L)^9KC9dhiL>x3W&BN!!h+oF#8_@} zRFHEIyKeY_LhEymDzz`{g>;=EA8#N59c50`5k+{T?oFF*8B-doJ&H3;(-!-Z;xi|t z2PWjEI&yplGxpvbv)4tCAkV02ZH~I*RQ`1go=~>vaym`v9h7=>(gqB*ZYVo4NQ$uWeYF3etWMPcO zXtvd6ipzOOvQI^w(TPSx zr*eIz6e=s{m1h*x=V!PQc`z)aW`1SmISVRcQYOr~V9vx->r>}W_u6?@D%l$-$w;sp zCjB7EpM>E_i_g#Y`Db0eEc4W5OJ)?MmAB+JPqf&xDl+3zi)!ks5|+(VxK+8{d$qUt zompP=S(|XYjBAPLqFXlmyi#Olc=LRDWV$@kqn=R-XS9rwackTcRzr zdd2*8a~G|hlA3e!^^3AAvpo*uq`K0EOh<+GR>Ay>X63Iqd`qrwMt0$+sD^8seR~Srvyrd@GR$W$D z?Y9+QW<|l$E2igJY8GEGY2GcD&MY|bqFGhnxbzHPTrfLb`&G@nlQT{|dE%neGiNPS zd{l4bAs4ubJZD*RiH%2>)aY4-GkQG&S2tjy8EozV1pR3|+Cxqg$5M-dg^lB!Dr@g3 zUUk#^D{rdXu2PB?A}YJmEhBNQ(VSejd``iXlB9$HPfVC%+&>7^%*=O}pLoe)r_JH^ z*le@TIIpn&t7kSPW=}{-%1d$j(tXIh08Fk#x2A|I9%qcEX!f~?V9m_WD#%M3^|8Wk zvzbRBEXpB<*EivPb(1dt2(?uTSFfx)8o<4znJ3ArD@uy8GgFfj;z?yrkE8nUg)6HZ(|ukxh&j1#8wRGcPbyh-H^ zeyhV5@C2*4pJz*`P0olnb8Ao2%rQlQtjdg88<%7)S&qtj^BZy+P+515-(9!h;a?q%{U=TY*!2i04m?o+5d zFOX1q-Uiu#3l8U!4&0H5?n)m7Ei-PNnzcDHH3TaOLc*bHFvSdGUX-Y~-q zV=(0fo9#X0$IP7bz%VetVVU6=X4o0b*aL&B-uK^#$c#*7DkW9>z4OlL(Tq-mR*}=R0RSoiBOyT1Xvy=yxP%`zJ1nBrY0=msV!52Kc*Bus5Q!b1_;@Jgw+dr= zyVK#Y>2yBJ<7}9PT1@mNi&JSgJa>cW#NB42Xt(foU)YkL%=ip|6+1sXzO%A?@!2h! zouPzufJo)>NHz|g{an^oVoSgPtI*k zjqkkeCb{M&UnXoFzV#DqjZsiDf_W@(W6es?f!q-^lq%wc#in3XSu7)!@OyA(7Wljp zaU!Sdh@g`T$CB3Itgc*}{cUfxg2gK!BS~7U?_k z8kpjjlpli;k$uhQXUnj#EWjH&OZo6}u@-k2OaMKL9#=FK^1Jj_n{IeC@6U|ZYhHqz zlEYLPb)Ma|`vUPm=GL_}lh+x|`JzZ*rJIv;XBSt;F;SL~&pChY%7s;5U}l6Rsy>*@;ZRa4EHt7lJlhD&{FKol6!r z>ak=zH&cpR8{T*_A2vB$nV7q>ayDwomdYug*Jd<2{EmM+@%)^|GgKONd1n@8{cEot zOz3oGb08o6)^N2xo3kW_D>nD^{ER!Wu(~>1p*aP9h2O>c%X67#G6FBz0b2+T6rnE# zSfDI6!**w3ZVcHi1YqC*lHDxtOUW^8kMFI{j4<0Eo5+A@JacSk%K+Z!#h}F<^_X?8 zwD8Z(fl5Z4yYkGvyXPl#Mnkpk-FwUXHY{dOBw^JVZHx*;K>y{h3eSH7Y{}P_u1|-} zp^=RzSI;~#6G&{o>rA8&b(%H9#Y`n+N*~vj1p5mAkC0uF1Fksk$KHhs?lL7CBcqU7 zL$M*r$L!p!v^aFXVX&pg7EIoBI8#q}P?7Oht*!bN+MjxDb)}XbirVe*xH(*29$US+ znDdLe_Fi?mj5ptRcWY@0Ge>e;g4{}|qkivwME)5}#*2fzEMy>gy z?A*^9I?Px8ne1rPqSbh^Q-vfVJlU<6HqTtIyOZbMe*NCfg&CtMwo9cNL(xdqZ;lBQ z*~XmTrqe`*0`B3>iK#nVrRw?T=dS$7t7|Lu%81tJ4*y9YRd6KppnXAkda9u>STaQn8vX|cbM0KU)UYHTJg3kF^FzGg?V}ZEa82j%0bTf!UFcR~VxEeP%ilgVB zo8J4#+tyt1Qm6`nh24MSi>K|Wd?1yx#R$Wq0lxUFz;6F4{G$=*&$;Gw6ag>D49f^d zmriJhBCwX|5#$jSO+4FXGULgZ`*fAL50= zW4q(g`bKf`M#{2K%k4G`v9ZNu{>+enDHKR$t!G1-f;|`cnm3xT#3SBV(iVv0#i0XH zX)UC&$7i@aa10nJ!b;q}9AMCDE!rkfi?wVj6m;3S8GZ)#RihOw!@y)^2?QP~`+BcH z;zZ+Ku41ry?Pj|f@c-edlHTrjz83&|fI>9}qZBJ`g$Wy@g60>)am&!?#&~L~TJTt+ z`KoJV<*}vI<=sWhmPgkS1S}VfRYb~YESNhB#z#HHW>UDbHTJf76=@fu=um}i^)#1nR z+`{bScx5=3fnFv@Mv?)~Vuehhsn>HmUC|*PU;!wm0D?NoL-TRpsHoA3)AiKc#nI-a zQFoy>Je)lH%~xw1!=A-S8?Zz!f503s_)P`>cR4hgSot846Xx7uqqdleR+FxwQJ7}u z;=X3JaQ$4(4QM9qWIH@1Uo2^f5Ak|iWGIOkX(78vav&ck1v%6yF08~KFjR&>#CUNH z!Ij`gWU`fULSJFmYL!G@3O3#xPg!(CPL)Kkl0}aRLMk<}yf|r>ZOjLssTFjBX=?NQ zaygj|47p8$VDi2=eCAqZdB5%vyw$5atBnG(o`{kp^0PXd);Tu4w6Z)DOoeh4kJY%u$dVlSbjd6iKH7X%tprf_hd?c&ha| z*Sz{O`LqLO6D!BUeqkAgmdWsVkGC=R{CZ3u@FJQ#a1*QG=efa`o8|ygqw_qfU~$Y- zY@-e{R|b!uO4OjgBl2hyrUQrI9*W=yKtknro&_tf*Bf^L9yGd)pcHz z3)A@X62!(37{)pQHdk{G>!bmup$ptUYntu6fgh*S9_xgrs*F4fp!on7nUUx0e^4(=G_ErU%F*kC3rvf&iD#T<~a!>?UD->5r`0HAsz<;=w5L}siJNCoTL z<3NrlY;H?9J(dh+l4G-D$;TdmsFSvEUCT0}ccJ#a99W3Ym_8>E*Ba zKV@ectaXbBo1Bk?Dbhu-CLC=D-QYk$)_RK_D`ayD%XG|z=$MP4me0=HaLl=tMBM*MC^LPH1I6>(TsttMYkL{oFeuRm4qc*^fH$?<2M)9wCyo12} zQ7bFtP@lcYA;*YwxOI|sp1lpZIIC3}#0V1j)H~=b%MA_Fu|F1!yA06iNK6y>d!|t_ zSnPHi>=F@&vLmZl1Z$RHCSdZ$t6TTZ0P$Ulx@I;KfX(y0lbCz2Jb4vybbC01-nNdMt zViv2FvQbdPKcXJkXaXCAh6Neg)Z^m6sbgTHqik5uZi*m^lgG6hlE+2d4tn9QF|KLu z>8($UU_2QPVOk)0?qIr*pt^-+!dwEPJ!l(7;U;RGIL7WD9ZkzlG=pnFHf;-q4Kegk(o^WM)txp z7+2@awg*=9wFfq~T6EvI%!UPftO`b@9|E_NgYuv7saOmbpL6^cGr-6g;+Ekbfxb~P zpp}g-!Q^I?o$Zj~#$S?lv%$b>yLqm{eMzW4!tT*^PfB_Jv(odwuS-6OhwJ?JL*Es+RY_Y=wF^^lDECq#{mA%+n{MnLXlJnb zDHo72kHWQ7A{20gF`A_S6vhI=F0?&sBuZ#mQP}y-QS2JzV4eweX*jb9#O26K-gR0Md*y z{e+bzahTF3Rk!sC3OB}pKtaCsI&BxZq>a)At*hX1>af>z*U6FrWdULcX)MB*N+CrAg~*|9pVD$jku26MzY?t^T+y^60^%E!KOe7bj)lv+FRe^w z4WiXx$_T5IPk;Ev3%4!qP_Ufz6c0Z5PO(5?&ttE!O#an6CtP_P&`N zPRg_?lZAPcCkVCDG;Ii-3t&=f{T(znG;NVk(2r?L@Nr~rq!4!t5x{|a9QTaPqZ5?hZA-m>r>`ajPtX7y!#=E%=tK+xfOS-mOxyY;JYw`+<< z&P~KBmtJm7(NJrK0>eFK2y+C#eO(v@ZhM(~ttp~xo6jX+6)L!R)X)$Bo~$8OX@*pd zM+) z^Hmif-fOJHixrFb(-xxzfWY{BpEA{!&#pDBRHrsXGNan?;r}1Y>@WU5kQrgLG(rWj z;OC^03sWO!HN!4oHAL)ZN&(4r^emHTYvF5KHADgxHzJ}&tBSdblu3jg(e?S&tM^A{ zj;L!zCP@LM0(sjmIb(ILD7upCT6IQN?LCCLR)bkYXxEk-LQyLas;*R{+@q{@;qqAZ z>AFN@|@cWe=z6lz+Byn07`EZBm8$Goj?B8ez?<2B@slI zVP0!xuv4IH!2+O9jm^f@^b~8E>I=Wu8-{x0E!&Ma1EC5ALZOE4eDmvX-FGgWA68RW zU_Qa=1bNINj?m=ZdOrzOspOT@;IiQaJwr#S8J$p=1FcFCb{LQZGEy#+OUl@B$X17? z<5C7PnwzPO;#>?nP=1G?Jb{cLNjd0l=T%X6d9C=B;Ef6)$U+GGe%hz8_}o+T2AAMz zmB$K3QKC|d@6MLy^KOSl7av{7M5ik)R*$tW{kA>i7N0o(We=qtScR-hqypJS&RyCV zAOEHIj&GFRDvA%%#Hf>97Zz}?j&h6K?WWBKPc)4~25>tRPe_^>dWys0Di;Po22{a> zZ369#YIX9bhWh+b;u*lX`{{goCR>V*#ewI|cfy|MbN6R`r4bd!M4A88>{_}$4H#E0a0zmeFwI|vH$20wHkX2c^Na!Zsx3$qH6WLuT3b|= zz%qnyh0P_oVZbC*E0lb#%v6zljfRnq8sUf4VBYrNBkI%(8@&cF-gaS$g5d>H-=b?! z#W(LSdKRuug$Uss%%aK!*5oU(3@XuNd^3ZkKl$=&peQ~$mhEz^`=JNP7FwS}% zsL}NNf6@PuQ9(G<8UPN1{|fdBWfCWw<75OP zPs~G%@UYxrBmWBa@(OpgDUN~ApqZi~2zeVvu~I2;K$TF6agVzwRl^Ks>a!&Mot_25 zS-DJy{p+7dml_T1--d?~>M-{i+8;I*!v#vZj#oo;Su;b z(ElOdMr}TB7WA$p>JfNR58OG@P4})`by_t7@Ys%c#%t2*3sqm#W%!^yY)OnIobZ6` zL8m!6v788$yn#~OZF|Y6kI!Bn-@fRw=lvloQUsp#M7nl4WE{#-ei6Oa*7=`>OqNg$ zWtmSv9HUhLTH8Xwkaa{$B8viwP98VQ=Y&Wk?C(T+roGs@4Dli+lyMRY2s}st44kLP5#le5Xj_*|tb{h{UND3I8K)nZz<(5=qQnuJ@A& z%`NP7?$2Q>3~`P75)GfE=q*?ZQXM06d@axe()ti7I%eiMaAywjF~-kFv(8|O%yOnJ zPEPK(5gUunWU*Mmwu7@r`ppV+*=YSN9ZTj5ul>M}{n!~V%;BWheCh2U`SJgK0}(HQ z<=OrW?-T?d%Z2-6Di5z6#$y;f0cO9PuR>)Je%1)>FdlnRS2zT$Wi~V(t^;csjzp({p8@Mv z$bN4Bg2!vDmfV-GpA$vX1B>d@;iRcDw=y$qK-vKEPjh2J0kIPw2hLBF;RwJfgQ*As zU>NJ^Y$V#T4urk=|23Z12oJtfiFhDl1Eo3^ z$=SvtO4Q@QKiVWr@i#i|M0}=koTKZIe7xZ6iffrTnhqt3$9s@aU06GigG+$ySJh6B1QSSuL0hqz}wmF(8hu z4|`sIe)T(qU(p(kXKvlgKlq5nI9e9Z-Fxj#2VUd&=4JVl z?PYSrgV-h=>AnRP2>>ewfF;_ulHjEqt~ROd*Cw~Y_^Z;Xd_nXQDP@--PnZ#^vLN@k zo5^YfQ-di{2r2_ezQHU@R%esZ88Sz+Mlh;bj4r21ZyZ4d3uvu^UY#K|bAAH+9iHZ- zUF6LnZv;>Xh1Y8M*0n9);`xf&iXVUGhwoZ-L7yey0l!uA>SVy390`pvek*@&EG+X| z!GGp|8+xP8U2a-Nt0*}lY*35$%ZCyUJu2U@t0-F!4I;~};}3FJfoTtF`Bdj>x$$hF zVF1d4onP`XCkX{2nE^~hrRZBhKBP>*@<0qm9!d9!`fruD?$}%|vX1hM}VIj6N;L?R~M0M*PEUsGvZo>7j9q#tMNvG@h62!9{YpdI5S1+wy zN@XG=`2yHb!4<05(F#BhP9(rSImHFXR^`bomFZ!8ei^W#2NFv5qR2=QTrRH|9$vmN zH+N$pUTE%Q0d;i(S*bUs%K>nHnvFVlKxfjqt5L0PW~6vEdqW^f%+P~BE~ZSLs5g@{ zxMIS3;m$(w;L7$)GPST*pWkZ)Jwd;q^ZVT;AHkel!I04whw?%~&*&F3SvYs@V9?-< zJosM|X?Hr}94|Q&VepH|d|Y3_wp-xdDY4X5x=Zh%WOjg=U{k{4o}Psk9Lz;2XOb~Y zUK}$rITv~g0!~NPZjbB1a|qnn9Ef*1h`NBCJ3djDijs~$0cV$0CT}}FcbAYmCu*aytzj*f+}pJSi=haG;10 zo{q#1_7z~WC%8rKeUflSVXAb{gaIC6*unm{E||Lr!%VPaSkw?JRlWx;EO~=*PoWs= zbH~+YgwWZG3o}!Pna0ExpyU`#V>v3vl2F?xBpq9nC3r&evA=D}4#M zFk0&nR;{n&Fui>PEIjdr@kKn>FP=G*JUy&a~J5;=Xrbb9-iIE??X^ zr)J|8ACZk)MR573#N1wawjP0?oBxN_I>tiOSh%0ld<Bf!}Ap^rJO2dXo@kv zb0`w`itdQRV>VmNult;#5DLt)QK!ekgRdNqV$Yi6evylz{>$04QGRn4AHxeM^HySw zqC;NFzv7`2jb9AKzz%5-rG16$+=e?i;&u8EQ_{H{mO?arPUf?s_xn9AN_o|vNyPC; z2~iou(+P76FgkMIjFw3iC{q6o)(_rI{^QmAschPT3V*+>n3%mt2Y`gvqM(7$@PEs2 zZDm3n3cE$4)&$Zzn+MQAbeho4lgCA{Gl&QB5?*BQ zb(sSz(^3fpKqNC%PC#hn(cakFoScB7x zS&#}3c}z7hVXrrgfqeAy381Sjo3O zk;mZ^r9%XP^wts0Txbb-!0IvyX%}u?g#E}|ZP}`{5`ZR7Xf>c3l?N%;kSRdN=`s!- z%TjZCan4e7)u0KykE*7W}l4BC27BylF6>x&xxs z=W>Zgqs8O)Cj1shFzK?EEoc2U|9IIRMs(8|cVYJn(CwV?G5F=%zz99oyf%k=wRL1U z?K+H9GjB#b1eCox;05+<7D0;uH_=q>n|Ol((N+g6DHuaMck#mR&e=1o%S+9fsruN+ za6X%iM^QQDa$tY!(K>S5NwvJts0~z#v&;hv(NJ3lP(o6$hI!<&QHVk(o~l}znxTIb zhg|tduc_fS{lrQD@d^{L^`Z{?*n`PwUMZO?-IF zennWEV{uiT3-^&liBmdXgMcLRa-w846#_|754v+diYd* zNzzlqNLddV1-k)w-K=u(DRvf$Zb=E zL;9*LUBk>RVj+?)?|n7(GaBi0HJlFJ4mqfn1-4RJB!Fdv2j~r0xq0i0`drTHR>tdb zFw$&oEH2bQ9zhf)rMVS9dZVLHTW1y#lNtq=(cTrLW_7eqsHmmS1x8%Z=Wk%aWb1|= zpGK?_Y&p`T>GdpPVe7GeXpJFU(c@Za5lBmI0kbXabS*n7T*b-XUJRfjso#5rG!raVAiwE)(`Xw_^cO5sK+4jwQux z8tN-?tazlmSd_xXZqnc;=q1t{^aMIpSQu=K-6<-{2`C|hLB0)Pj@Dg>ZnSQK*_T{h zq5eL1ZtY**KD%;n^_lKYKUSrfnTVQB(CLR&^By(-kI)K;4Uva-e~Kn|h> zq#7V(s4_W5jNm3BoFpTP4#U{e>zNVCkR;XCO^6eNO@JIK+}!^b2$kn9?4CWdya-J= zmWnGvH6JC^f!)DWhF05m+;SloR*a6YZkY%-%_q zAk%@G=P`$~K!ClO`$E$Mba$AQG)O0Vg);z|V4ym7vuOuYDCcu z0Yx_OKhXwQ?knh~czO#mhd**?EqFhjN+*#VQZ*Mu=NBnNnMzg*>BLBR<;(KF!jGkk z@laxTTKb3lA*tW}pFq!1-t}%r&-(j$GrG~;8zYV>2c(d59?Ld@^ zbw0Ca@m;{?~quv<3uHmwGD!ZuxUZ}CYS8GX9E z|7w?r26TP@hc0Q*+LHPae+AIUOXyqh-A&sPmTbExu_PTtK``n=t%=PbqcMPzhHxTe zoI<;{+Z2bPO?%#j>v1C?Mh@KrW%~Gyt9$9J+~XL^)Q!!}WYk^O*b$m$Twm>IwcIGU zw?rSc^YP6tq4THjg#63h6QX7K96Q#hgwHw4eUCB&3fe|5HS$x-9&A4yP5rwILD=ha&(&s}P&#MNtgZA$>L4&7ui}#-byOPRgrJ>IbjkaK;GIK@UIXX= z^``p@dec3@J;z=9^iq6_3-qcRx0`w0oD& zBmKCxqHfJ*d6d>{s_c(y+D_N7?N_?yF?4}ssn&UGGL?>T+3)d!D^pNI&2pEVsra!bANH4*)6D3 zYaJNJwp(P@9x8@W26}3vbL!e7-s|AdEfG> zLIS1!<~z}9kJ3|dr6UR5b?OxXYoZgH{<8GrcGvZ%LI;E zyb-%U;WgPJKB;^T}4<6YPbyn%LR53BEx)wXqJ z|H_$LTeoDR&5YLYk6^U*+KuRmoC#MZ4G!LFOnWmChlYUpqi3#HYnSI!&Pc{%Ho1$% z%t+Aa$Q6t3%v?D@jW~r6`Y8L2`#r^Zdb91@`iT~@B|fpQLbi489Cx<4X+lv2h;%gw znNwhj4k!F$paSY%@caod{w*(#pPM+>iO+}caD04z55;{Foc=~HX&oQ5&;Laq>Bty< z$YvH^?42$QKQcIyx)LB29T8g88=&g+oE~RG2e%_Z zt;p+Vqz?@A$2iujhwf-IJ@&i>;ehEWo?Bm?IzN5Bv$r_5G^_d~^q$O^fs_dqi>Nb! zExJb>G(C>u6SNzz_gauA>_Oh>vmBxKm`?@yUg2KkCYm+HrBZe+r@PzfFYWI=d3*20 z{TCHy33TioU00~Anw`6p@=*6(0sawg5pcvY4Ygg7f7bQbx8Dd)=>xr__(pn5|FWNm z5vyT-6J$(&(*bv}xhr>{29erbI6E36G-Ia=)YtJ@UfSJWI#@nXdp+VKc|C_$=jmJ? zZ!Za-&hPo(`pQzSH;B<*-Dw~$|GSLiTY zC1JRZz;g9iq{pe$d7_s{j)Y6}^T{N?@84nEzHYw{CHknfSNVO2J+LlKHsPOI%EO6Z zDr-SUP_x%1T3sIDsa(A#n!GNn&K#;0qZ+-_4l)k4&v)e;>GN%EHm@vRd32wzJ;>9$ ze21lTDu=I^Kp8KzP{(|cuQz=XU#~Kpp3Y34#@B1hy7|WXBWP10>x?h|A~DZK)o?K7qX1y)HXt;mu!0q{8Xkx z&*|v-AshlJ2mXH9rl45NndUk|@raO$C~cx3a-Zb({G1d2Nj^xEj;Cnrahi?)G69+8f|>I z765s+DLh_AJ0lxPk6Q0iQ{DyDcJuTa0*Y=0q4QnbVQO2pRv zDz>EZDw>)jm~gogK?l8xCRQBv(W?YU3lX4q?IMe-v~xVSxi>Ytb~e8 za0Z>>uHFc8qP`nG)Bl=|?e1J`?q7l7e|zz^1X4N8MyDuBzsWiE_WtDolX|L6J!l&br#Jep zzemh-{JQ}neiScbp!gww%6nJm1OESZ3dD#Mh*6yap@6hR ztt&Js1#)hyIX}KXvEP{l0jBn3NsxYWK1nv@=Lg92B#Dv1GVJu*4ydYn7ONP0nyp-m zv~s(``(hXTN3Knh!uvbt;J_VB9vpVyPK4w+a@#w~dqiAYAmZAMvL`dMu{Prned&&N zS~jIw)9V8ydQ!h`kW^tqV_p6-*5xGXhQH_jJX@Ah3ZTjv^~SrjM0@7|Xkkh@fL5Q? z(ZjcNCIJrJ1Lh-20-WDjS(>^&eZ4acfJJ@sG(g{leS&^0_p)On+ZJ<1us4im;1H-*A$ogQE^oih3zN7Z-nz586fF5)Ds^#4PAMJ zC&3TAw+^ly$|YbP%trHFlPDaKOxQn!y;@#6*oS-m2UScB5H}tqZm73mKe+ zuI_@fgb2>EyN&***QTzi0WFkygm{rhV+3}`0JI$8M4S-W^81*DqkN7Nf?WP_fQLf; zwZF!H5bD1C4sbQc@;<-a?zaET`~-SEqRBnAl*`5P0kh5sssp#r zZ4M0!&!fe5)NLA0Mkk8Fpi^VEyT1N?OJ^Z4J@*z0m zE2X@$J@*fq8nfrV=l(RBmJ9dfV%0jEXF`nq&;V4~0y)fYN6+3viu50J(=KX>`!#@gJ?`I`(%V>%s_ z<|wJ322=B)0pdR~yykBPO@d^Pi}Dz zT+t`9$9D%v^@R2~|Lp^WD%s<|3z;hRxTII8$7)-zZ~!wL#^khZ>m8|R2~{R7z0$g+ zpFJ+$^TyiaN6y3v?D63N({Mt2oYxGP2Iv<=F8RO4JY-Qxk?@Ftkxh-nbqb%6 zxK3Z-J|{&p?Yl6P{VsUnIPCO9KhpXHL0I}kwkB$l9c>YeJl3&XV=n?}Ch?#4W<6~- zj=qa2>t2+nK$)H0nw`1*#Fa~1FPwcr&0uPMR0h){?C?jWH2pnH;ZdRRN1;0X!g1_! z>e*1$d;z5I&v2W~wJrFgaRky!VE&vGfuusfP;pBMl}cnXh_^JMm5#WOa`=|S#!}r9 zDjaNix6aK0Sxu;N-_HAg`=hdH=(@EumUWd@YmV(Z&ku_r!m;=gUb9R1ew#n)a76t! zmLLeGiylf4cuVPkDp#T9J}Uev>~H-i?FR6`b~YAf;KzAk{*Xm0Jbl<`rQFBA;QyT8 zhCLtT#w4TM)i&IPC&?nGCYUx{NoKg561n;_*}OvoW-jLTs5^8L0qK9Wc`SN+DDKQe zJgG|9Z}$W|!Yzx-FG^N(YH=(UaB1z{0G=9qILZGNdPZI3zI?xmM2BJ#PjLq9bpu(! z@WpQ7pc2sD%GvLag5ZA>dG-sH2&>E0>r0G8w7qz6jk?tGc*5Yz%Hv%j>HX34g90o2cnbfo#Z@pPKcoPqI9oi23^r=5G)4H_dAhpq8l0reJLt1pYb% zDHx29lm;;nI5QezgujE7ibj6`4Zxw?m4yV+gF@+0DuoiK2R}f2tIrcKf9%^0C=clS z_5JRa=I_kL>T-3YR7fSF5!P3JkKgMLF&;dVtSg@ieayQr?>6c-GaAc#BgxeG{CH|_ zzt22I=Ef2RyVq{&Th&0D-~zsH}Q zsi2jLoAf{#+&KmG58dT1f2vW(#3+?PAw?fZeO1v1MXGS8od%K?2%4(p)lFAXKS*`n zxZvui=gOt%WR6-}DJ3l35CTn#b(LuO>a1~OtMs^44Bt1Gh`uZ~OQyw8U92SnLZ1rw z{%J!Io_;=|;n=iS?38DqsIcG~qK8 zbE)B=DZ{S~zjS8 z9+gY0%_VspN;ZUOyAghnoUlCr8d^2cY*@{O)s=}L88u4mPQ zhB^ST_9Og%j82Cs`YF3wOZzv*}wtK0>W$NUUp0hrh}1{{s@aP%B1enp5z=`g%= zZhdX3IZ@AKGcMz?@ZZGU-Mtuq(C1S)TQlv&a8!`i=~Yp*C-bR{K5%Y6HlFkIjnG&w z5Oq4@LD!&oYkD!Lsvq z!drDj?flen#>cc~_SsU&=*z|`Suv3I*(_#@!z>Damx+k6u&Wrd$NctDmuR;8jb?OS zQaC>T4!EfuM2SDuftx}cNYYwhB?6(89t{nM&X$-6ySYB3(G3s20Vk0{{1HZUNd5vm z63;fGjh6CNQdO?%Y8*HI^Sg`9z014T&R^SHZ|*GaFgV7ka9921*H?iOJMK}uAy4!W ze1A>apF4!N_ns`Je*N#DO&3v3bc6eeR{c6HtvS^Oq$0#SoXD9pV!I06%A3u`9rQQo zUB^DteLt?mE$9lc*ZrhJnV751*u@LWOIPC0t2XtHvH1+}LBD25oxZNH#E1=-T5#y7xq}yxBcW1>o} zf?()LgYG)zP}CV0;xS|lhYkZ}00_=hR^Nhdb70*$;vVq8%B9KRi=gIo=qdrGM7l?n zt5JUqHkVI8xfnV$O{!BiC$2$eNd<{Mf=ws+IVVijJouBY?i?q}%{*A^(aeMLF_XL# z+^%UvR&KVsaME-{DXXFt;6bs(3nMs$mA!)m3nP+@(cjUfh}b77&)CmpBG848C?)00NhPIEhNbFC(UZf%~`8qOuGj z=rCC}ql#TXNU8NJKBagP$tDRBNRVn?haN@@g4(r%SxRDnR1u%i3Qf_K;M_-!s{f_U z+~KPrRhBwnw35n0u^vs?bfi2#m8PCou$JhUhi-roASV$!#VZ(EEDF>JUe`m&g0|Hh zUW;zVMr)dy!wXu2*$N5+#4@Nqyhdx#e6*uG{DZ&flK**KEFMVDUmhF3Tb0_yTSC?C zcYf}@ENX#{@s;IEBj3}}FaCEA&j{HESd-{2R%LVY1FE`Yl6;D`E|dc)6Ln)T^{$nb zL%OxgkGd8u))i&YBm1I$EQD{)rae+Iv*$F$%)Qq5sp#YGb;{8fLQbRE=!i}%2(ezCxtMbYp0XE~Zmt^)HEYmgag9~t^|U7^ zH=v~a&Lsb7?59a|2KkbdFdm12iFUZxp?44tgO_G7YV@SeS^*U~1q}5g6KFe(bm~%8 zXyWkA20a)d2i=W;I{VgkJ_uiXoI5dTa4t92n)B0Bop7!GAr(@Lbjnf$OcgiL^w5C( z3DQE9uASF2h_Z3rAF9cPUS3zcNdFXpp2gWMVW4`dkgiPsm^URyScG?)CPKc*JO2Ws77;n zwcoz^`XBU|r}D!!7ULq`$D17<;gI66sYsKE4qCqpo0V8lac;>jU6%u=zDjCnNqmnu z-1`Q+gKIPnCwW3DAh7JvH;*`k`hWd5|q? zGTUUwh9EDpryAT6_w6dZPMW#Wk_2gFb039nG%}85hY1>_(xH(D-*L5xz&wdirG~{* zsA1JMI+^zUq9Vc$Gv-LG`-iglsOQL<(1iY=o+I1b$K`xK>p5Zvq;C{)L6+}VeWL0# zl4A;nDBqQ08|wF=A%=GtG^#KHf)1pL)K^kd5vXpNW>$SQ^7_;zWcw_jSTptI@#W!S zIA9gI8efAQ;+G5##HmlvA4IiT|8s7Ae8}iYH_p|^=7977q!E-CdLx4mYW2Vm8W9TB z+d#M#w!1dtwNZm>C{UW#yW*cwwsK_l`eJl_V`V&^D&?lf#^OFagwTXz7w^64#T(0_ z1yycQf40iszq%C~%LgtU1S@G@YmXDYYK_J8CBD<$=D9936=I$3Kt7T2QvR*ONPL63 z3acb@!rF9Y>z)uO)e-`WQ<<@MC7XGfdzWPPj&zy5WbRVzNJUDdUM;j^yUg7Icd&*I z%Zqa}oi;87o5;6lXK^Xxbp$h!T68BcZQmxZqLZ4m+iIOBKyH7HJRtRBUTQ9=@Jj%* zcaXP8?U&W39nYP-$+E7ko{j@kddSIxJQ9!8YMculj^k_+_=c<8ZSMD*zFFR=djiP( zE0>4S*DD(~AZ?+QLAcYMOYo+f}-vP@!d<`9RZ$5r-``T>`2%SUH z*>u)dnDS5Az3_f@UKT}?JzM2hxKR_-w-%ipiA|?YwmPXenVeHvmDv7`wP-&us#J%SI?GHdfZiWwP&{WaJNM{ZCcztIIRH%X@i{aEJJURuAnT>|%A8l$%SW){ai7_|X<0`EdrwUyP?Lt>J(vkt=LA;x=#4Tqyw%5R7``k#M3E%g&DGT@F`faw(d8>dh~YfEdz0 zQixxB^65(R_DXUVvc{egM$u#90{2?el17KpXxN2)L?~+N6#=GMgBGNm2PR7Ri_7m#Eju%i62e7Z$HhHnzunw4gPXfG3#r zS+w_KSwva&W^_ci62QwEuI+7htl~@|wO5u`ah?{jJ2}i2up{g;(-O7@5?*_D`}OB6 zMyx8TiND9cEc_+Rh@@qYUfR{_mL%d7Q=zevev&a!okoM|@Fr;)}v6mE1cg>kg~f zr({ZXa03q))AdYET?!66;7G@>O9n?ef1m3Z=KvS*7t}*SZae~A$zx1pBd#+pBL(vz zgFQfdDK*`5qTOo`bCGLG#jwq}#`@&i;ZoQ(aYawm2Vs5M$dB$}pA2pP@lHXUjNr0E zFfzXmW=ax)kxJ zJA`$rczxz_nJI#-4rLf!M(!YY?=cAddve>LFa)5=fMJJx7qJH5uLXI^sC4c zSv7?K{lqR3k+mJPTGdUopZpF&bSgYE9{jl_MU5_Mkd$ixcTt;(%vS zpVZYOpT${poQ1#vgC5r0>irz6&S1U6S@k-r{uWkC|Hr|VZ4HyU;3gh_Y<=yydyl>H z_$vqd7tWvETH9UUU0KSf(uH&;m2tVeC2-*5KiN*8Zru!i+cM{D+EfhZo)kBiL3OO~ zGt0NIR=PHNud z#m&Yubv2V{ zk;iv72=DGcCDkvVgU$?NRhB`i50~UFLPNZOd<|ZmoDo>a(Fo5K^O1VAE;UGp|DdAK zLb|eT$WoyLDFW3l?)TD(UX$AA&HFT>fJPHIfb6(GV`CT_Fos+vG8P>>_87=FjUkT< znpCpRHAWG&m>vDw6Nf3{`VF8b2i(Iy!P=T(@4mo|H^&l)@&M*Z^t2j1z`OD^5F$pN zhWZ!=u@GI5264m!I;zaR-*Bj2@Tjt#eq$R{kt00(D#rOZ?3plEra8hA6Esw_$Ly7k zb(Tp+%F)s>=BUF6={KTJc9Vw2vO&H_CG0YGGg zZ{-kF<_t<2wa-Wbs(Q=XTmGDD41E8P){P4qdtEd<4Lr7Ep|Q zPJYT84|+^GyE8SBNsXk3yxxePtb$^Y$0DIAHs)h zze&7c7Wi?uxqs4;y96dzLbIBA1d@=BM=v#Ux2bIQkViLijEg&bJO5(y=41O;E}q{$ z3rAd`3bUMwD(pxBo!aHQKR~djaRUGRh`CUB!Ys@uT<6X=w*m82LKxJl*#Z~QxgcV_ zsJ%m(Mo6OkTUnZ&Zj6sri}`NCur`ell>DZRk%A! z@aB4I2U0C+6du+3m3m(Z^?0~i6JV_Qxf|CmU)E)uPVQ^4xkxX>Q#-*r(OIvDQtuWPcQo?Py7#&P6*rK;Wke=LlTi^(;L6Pte=% z!FmqE>X>iN7=ZmiGDwF$qrjCTIwJ_OB}rLS*;JmLu8&oQi-^^?4Q52^`*|)$3#y-i zd0~Jk`k0*kEi9fJ=6)81>Mz6Q8*Prjt3);5R?GAwFO#{QoUnXy%kRg7iGUlHo;^J~ zTwI)}1OhRy)2z2y6O-lK!sHm=pg9N!YsIi^`Gx(pVgw(;77ac8ny`sn%P#kmTb~F) zk=v?1FPz{)E+*sKRUZJ(Pnj;dETU)rFfjh)53{lh)HX2y10YX+jo|~OU!<}*}9t?O~V9wsL@{n33p(Upl zZ5k;@*_o7V=W1+iR;J&aozwwdszdpB+#_nsNFgSNOlF-x*+@!0c4lb|*~J_4Q)h}! zEgB?iAv|+<*t9sqPwqc^cQ4>~dNZ{c&&7?Zy4n@`n@Y~ zv-I=GCDJ?`agmW-MBzwW1ijVsNp#T>f7jvf2pmc;R5RNI69;g$h?f=#rK{z3;J$ET z3)g^Z84Iwd!md>(2!abWdeUpoALmvJMPKAQsnNTzqk0OBV~L(Z3_i*Wu&j!5pPEf>Yvilgnv~7_O$pWIzCxT5AvR??E;_)qHIJ z^9rb(zoIv5dADX{`F!rT@S_kN9z@n6eA;L*B{$x@d;W*swyE{xQ`Y*%UiJ1X%gL|* zW%bN{uDDS23PR?|7vEGB_zxWkr5H%p?aZ6iv>J!5juJi1H95w>h{l z?2WJh%g;T#x?ZM?oT&*x^SbXOqFhK$ChNS&mfGMB`jsmZYHd$mxBwtD9LoSdY>V&{ z#voE2fL5UMvTF{G3_rPg$$3D`>8B5iR3mYTL7v1VcAH<7P8+esBSuA^>^G2@fNM>` zeof+}(xG1Jjs?L1#2u42IFm<@rF6lk z&tx)1uReLD*K&Cj4zr)_wU!7AqrqCDn9UCNhtgDIso+Dc20TU3|9WAcpdPeR3)MAVvpKH2}GLh5yGGa&C z@Wd3MYc^6gy`?H8;{^paVh2vrX=5Hk7mhjY9hF(A@Wd-q+WMrEiiMy+KF5IAO% z38i>}%VY#i;bstVQ_8eRhzRxHV5@Q*@iyU^#f6gIR;nFl;gS&rog;6<^*`7q-KsSF zjvk5nXQxL?xyJbU4rZB1RAe|{di15702OW zvFVqG%8(xf$!6o1*~oA-@>-n=0iwR(WLOYY`JuZ#=zf#@&*ZX%33d*NYX z$I@JdvhWtR=w&(3{7T*$VwALT3pt6R1U}bM6eX&8Jd&B@l02CM8A-d?tZO&Wgw&Ei0LwMGnFO*X3dFB&+!If6I7F|evm%V zNuQuCl49!<%mIEoLZIM5L5&LICnRSJpy7d zck1;}v2?ph?q&dc4^A?swd-!lziWSG_l-Dtg6GZ#1D7wJy>{-}>Qb$mNd>loTj*mT z_UU6F)z1?(kZN2}L>K~!Qc!c>4!0WF6>E=9-}rXh8^m^PPAvFB!q zL>6!ZXiyX_8^9ad<3W9&(QM#e%&(Cc(UB0r=Ip$^-<_CXcOVeh32dL)U_1&Vm|6=; zwWMv=xe1}JJJ?I)z1f#vf&bM*v-+zYq$Pvc6?)C%|Dk3qIjYnb8;rA|57f7#K6;IN z-=`-VY1D_2UD8nJaoXuCE6~ZUs-pc zol>d*S;?7Fo!^^oL1(rYCq%&(4dcs+SE@duo0jX2G(vBx?4GO(?&fnJd#mV7q6*3- zf?O&ek>ug2gnH6q(>h`2!M8z9#OL@grL!6!f@IQNF-0 zpa!O+qMQ|AvNcH6m@ukU^Pp=L``LImabCt`${V3GP7fo9W*`>EhN8-H%)q2H0~(Z~ z7+~S|EHCc}wg>Yr$UfrCQE9m%`og_8zw}tY>T<|miMf59^CA;{llxma<~E!c%&6wn zm{`n>e$z?6AtOnsqdHnJ89_q@&5Z+D;0fvl5&{#n0ZR><&DtIEyxDo&qM48k{>cIN z>U2;c^Z?~NZ`}|2XZY{&X=SPf7*D?kdBX{sT7vBzGQTHsEU(B)ZK3J;OA5P9*y%BwE#}Ch#mj`xs3~s* zgW2-+&kUDBlb2_z&mPQJeK9BR1a!b$nl(=CK5^?HnQV^5Jc**$jS5`=51#n;WVP;| zt>qgH``9S$IZk8Y->vx&bd;Af-gjG#f{-pb+s=>*Bi{vu*Q}+B@laxTTKWfP1wBin z`2wD#|0Gh~#9J@<)^b6nc0_bq^!bT#t0@@|gbQPpoW^4JI5mdiaLOBw8jM~a@UmDo z>{;9&Xnv7B%ciAgk>YMYPx}W3(Qfq3Pvzagut^sjN=00nEu+tEa|J?1ODYj?_@f~Y z(<^u{LC@Z+gfR~JOdQ78{cg4Pvr)fm>+!DtaIClQKOX)kHJ?LvK>tY#jb{LqxH16# zqIpMOP>&)%epB-!$bacS33!Jx-mZAYhkL~>G?rdr8)>a@pVoYwaRM9fdmRQQN466b zFGJ1d+ly3I^YNZlB6wvs=W+fS&HGUstN)~4dS|xnl!{T2=|!awRugABPIb=G`g;cR zOfvS-{bWh!+8#11ooJ!R#|E@`fQ>MqQ-i!tJHOLSNICi`wRbc2#{Gp(bCYLhcb7?;iIeSf0)9^0@6F!?RUyoU= zHqeE79QIJ!SICxXfr!(j`N@RNHSWN1A1RHG6-1-e6@0lUe9=9W_kQfx-!*TsnL7eR zLyIYWC_5T`pTpn?x_o!u@&0dl%x%*>coO!z261$7Nn`Kl5HV?Tv(2d@uLW1V>^*bv zu(iN!J(QF(<}b)&MwCc3W+NuK&!EdC9x=XB6Qv)jfipIefdiMq z|8&r?DkJT22W~y22ahxE-|3|owennlh>d$3v)ydYNh3#w6D|aJKVi>FvrQ~Es@Vq7 z;N*A>fg#nv8P(vRfr~22Db?|I+~I$=>l{4J;CXlFS*gtT=h(Qnxl7IS@_bWq#}-mR z@NyAMYK@(8PoSWJPsJmu#MV1aJpr=kXQvwAWI=#XEeVtu9B1tx36VdpL~af^tBxh1 zvqzn0ioB%#vCW}xdlhBCBr|9})^G^zKvkQB^6IU%LXuK~sA?GXr}Jz$)Hq0y(fiq&njszoMTd|A(IaHuOKp;H>Z7HZ^0Zns z$I~F)W&OvL#`kudIO6e4LGS8ZiQ}U`e9|nE|K`6gqx1o^B1hLx0T9 z(7>0PGi$SJ^|8`)=kVd!9c%Z`fav|rrVS1?=LW?2fH$M-+}0F2cFiA%I{;EYfVeLJS2I z&O%gxvDp*+br^Oke^(?*gX7!;@0hL!)EqcOnF>L^56PZ>-v$3PJz7mA1@7wp=Gw~g z!fbVK^hzO@tfVSFkIP}uaS0)TTt7d}`<3txH5o}Ib8uf-Rv&yq%8DeUYt}#565=oG z0AUXpO^HO{|KaUT0OPue6bgJa1qyuZ%T6SnV`3eYs>xk+hMD6?8NO~jktOSjkQy!In)I~^#s3NA3 zhKFnIynsNaIc-AFpP{3+I$BlXvk`?_g;p#w`4m!i_e$alcf(}KkQdeyj%F!R**@OV za(n_ixuu5gQDU_j64;XwPjK@Mhn60w_^cARmB)Jw`^i@1plwZ$8U!txjcZj9H8o=H z1QvroI#L{^MofK}(|v7Q+P4&r8dk@uM=kHcau)hphCW|prmukrH7!b0H0joFJf~ z3iUc8;zjW*jOumz*!i?Xld`E6!2*gXQifOR_1P|*3wLuT- zj{>GzZAM11isVA2vHW8=waHLNt^z8oa>t>64-#nyV*^#4U9LDPo{Y|t6;IjNXrBt< z3=}(2se)4dWW@)08#7g0#H815kW|)i5DTC1mnxkI<1nwBNxx4C4K9{X_r(bw7#%;> zReAZ|>YWi$$dx4Br+936Pjm70pj9;x1%N}_C#WUgqFkoVO}Uj08msJ$ZNQEa{$=_YiX*hsR~sF z%H6Iqi^P&b0;W|9Pe4F%CP!T4(Z|eKl~6cs81ho!-qYErH5!dtn{Z4X(Ot%SJ9Es;|1QaKiEWccmJ7*$JmwWYe!=u#-iW{Bol$6;Xw5 z;WGO?A1~<^o{6*caCu=8=Wtg?LtWueSFKxAi$b=m7-~y#P-VHXmJ0aFWBn6itx2|( z_9$=%q92vcFbRJSYA>*3S!$}9WU(e5k8T?1C-@%37q(V!EhGROFRK%8)w1sORggoy zf@gg>+AJ3!&d9@iL8Ae-Jw1l$u7_QxmoNp$Wm<9$OeoWy=p#cLr3R`83TXq+=_+X> zyQwJnlq;NE1xXH;auhB{hf>jOdHk;+)|^BnbtpYRHIQ0Cx75ga4*^UE8hLX=s;j!Q zaMWv<{RI*2RgCxd1`1EA6|MIyms_i4pU$i^!aoleTp{S%h6}0 zR0G(f)Z_6Oe69o7J^u75Nx%bHZ+uM2cwS6 z)y(_6HaT+M*oORTKt0c_?IOq+&U=Ou=W}I6&%pOhaQo(-0RDBjZFh{1ZrV85)?8N; z3H!ZecI=G@gfwJ3jD(GB)>oc85?LJZ$`ZOirS1XHq_ASBRO3$J7p--ov}t2vOLs)? zZP<2hd&`cl%B{n0RO|`{cX?BHP;c^tT=7;kUNDw*cq{E%OgZB3PY%u`^ znJ|4gU(rVa_Ui!j!hKo3QZ8Rhj;2g6>ab8QVk}4YR~VZ``EOj|EIwayoDk9+^MC7> zk)g%JhaO!g@$)R?S3&dtP%P)QlR9Tm)4U=2z8Ca8!2YU$zHQ84LS+MrMPZ0A6{;DE zD2#YicIxo=)QF;a#q$u6l24PRooF1|I4H1Ot>I!?BST=lv@W%DzY40qqtueV4i=PJ z>2vb_0{Ah@KA1Lc5|Eq4>F(H)iQb}~w3k>D3;G-6BZD$ZP_hKMmi zV$6Yk+r|iwY%yD4K)njKESadVem%6vg;ul(uZK~Eezc-g2H6)PUV!g_`m!O<4c-H4 zGO`D`+bXGFB#f&?J`n1nmWqceeIBz>r)3>NJN7A{BqGus5mmNn4txi4@~&2gZkCx3 z79Kp!>r*7EIve$xPdKp=?#TELIyO{mHBYE?8kG%ic>$dkwO!EEf17oSxX+DT{<&V4 zTX297irZP~g9%LXRBD{xy>>x3G{*uQ6e#Q+=r~{72A|bbv%Sx}%Q<7rT_ms?a zq(I7o;%UjflbxnINLEA@(Y1*B0)YXBS*?T+Y&kM8J34E{XOzEn@S|D0?kJ?@)+e-2 zykY+=7$^u`U=ni_8uKJyx#&KWAVikFRWlxcR!>vuK$gc8PFfh>x&yQEmS65hZH!H=5B?50dfUFQN{%K29)+K*%BQjfiqQ>>7#-enwNg^ygy2}ZW>l`EjPgxq3!ZkjuU%TI+Q z1k0a&Y(Pa~Pq6&lS)4Y!1dXNT99o6XT*8?pUimJb_bu>cRY1QX6FQ5}iTwjK8&K_K z@uhr6_$P?o8+zJW8tZFPk#Ha#Ov{7F_fO=D3!&g;!araE?QWEkMDoilF{JKQJEaQ8 zw~RwdWFd@m4mNWIYh$hHCaiReupF{efyPMVi$?=(!8Un(9LHfvxmr~8u*9$erL55W zg*$8SGTA&Z*5U6;gK8hD2-Y>v(#aj8Ojle1;S&*V}VK#u;7Al(-`8>VEu;9D0LZEq6rDIxiaO|-~~6$ zsDeR@N>_ZA%New~pr({VM%-H#t|^ao*2SIiGP3Tw8eqw*bpW)mb%YXbJ{{5 zow+LLIyq&pt*s6_FTb$J88e{wmOC1DUNh*ud|9untF?4(JJfjW+(4zpO1L1N6Y1(3 z530>3gFlh71TKsPHVzN8gg#foAp^VQN~iD4+^SSU(k zIvdK~(-ArdV9m1pmOg4fHOHY8t6;$GlvPgg{MEXs_asL-)$tuuc1<9inzs&g)(GJz zRh_T2~0k&C8YNCX9sGfx$DkZ*zVqq-;V`1!$KDZ6xKSEpH0T6L zclmpZCSSSZ>KA6_U!J$t)tb7tA8y<_Gu%{ewfe%2z5_$e)d^3}>o1plVq2_vx4qe7X??+EVAG07VO9Skzb89RFh@PC zV(XZMc?l=$CDwl_oBMSUC6{)Sook=O_^%=xH8Xyop&&g2#eb5ZMz#WkDnkmziA8g+ zuwhegpBtiR&WZ(wj&XYD7lFhsCb~Gk|<4&|W|S%(U~$LaM>S z%-K*LbT%NzO1RRU@FW20;SyX*)i9~;h~k#;$h8=9)?_?y?GoNTdU7x*1)9gtjO{u- z;E(RPdsn0-f(GatI_tZ`rshn-ocPt$_%)l8M~?0rN;U6U7~KB$g-!4AR=0MvI1ldb z*|ooNbkCnRD~lSB(IrvmO=C$QKLP&lAmCU8%7{b@Vls_jHY-WX7!R-VP9-VBEZLRn z@_I}X%AXUMA*3w$`m;EZju)JWh2xS3W2|T#JGCj0O`wZZr}wnDiv}hSC~@fUzM&d1 z60p0il2+renNop3Po<$_*QwqTLxdMUiGA6_@OQ~P+Q5K_13w1bwpfYL)QtE=z6^{{ zfxtteCvgeQaR6al$SHU=G6P(ZQ+eL76`A(^MSihWFi)@*7WjgPB#$&!!ox_g4Lnnj zR#7yUW@@aZB}7v|6*mnQeB6-QkS~;2E0!N>rb}qHn0qD3^cAg>s~G0XCCWlF<0PyO z8Yku*w-&(c;$cp}!dE!j*MwhN+&&-wga@wRR+6O7hAh`n$v`7Ui6Go;B(WI#%nNFqiX@c0* zYIMUQFX)P-2$u4Pu0~Kw6y#>c{T4p%PKHPw1H1zaJ%YMlMiVyGCp%Le`J-KhCM@ur zt~kzT3w)@n7~oF|i_tS?<}+sR+M6ohor0k9&{>1T!dC5rOnB>dUfy>*f);6H9d}7IB(ci_n~ngiur$ z|Ce)5W%r>cC_u4rl&J(Vz^IK?1W;{MB;qc%{oW&c4iT4CX^oWwy=|`ap)P;l&~8t; zJ=_ooHN^a;s0SF9Xy{-#XA0Ue_K2?%+xX;PE8Y!dw?2DQw9booN2q&e%k~>Wm#Sh0 zo!9HA9zM_{YHBC?Q)=9#TO~%OI`rj{q%BqZ=b@afNObNLGj!h1zEXT+qeHGTDzA$t z4vO8`xSStD8A^4_9jirv^DHm+~;Le~R2(xUv+vq1VkP;jY33r>HC#xj@K^xq|hkn+>yD#~wFf zuGFK)5ilu{piC|$U;^j%mr7A}!NTEBH^?VYW4%?K!J8uvZ|vVd0civZ&B!9|7P`5W zk_D5b$U5!70q7tvFL^L2D8oe7OP`qURTw#Pu&>);RGEC95NeG^`%;0f$?oPo{ZXsa zQkiUvSo|(?ynADJylLCiDP=JcU)nj?iG*NdDCkO5`l|xLrqRyYZCxREIAI&?1_p%2 za=f$~*q?XGw3Fd_Q5V4=+bfch`b0G{rHm?j#9{6NMDy2GE))ScGS`CNd_Awn=LyXm2T10zV&U%WKWL*%5aCQ)!;w zCzH4_i=2?9Sb?aLLV&@T5mlmbQ}HQJYnABULKRUeuaxB6h&49D3o7|gc#%b5APDecdC$>x0=6rfoq-p{r!2(_ z<($`;7l~z*_}X~USICPZy}jni@S8$j6sc=IFFF-{J;A;@_P7!Hx@{5RVSTD#v69-( z(Vx2cKyBx2NEoZ6>;chVpzJfI>q=+CVZ~3(@otr8!gejExCC;Kf$N>G|JSa)R3%K+ zwXra~$U0p!%l`DSVyhIPZWhA+f?-|V&wl$D99Bdow6>M%pxyrDq7inE!$d4qdIA-hg$%gRkYxjhs*SVME#|PU} z%{sKPP!V1%&%aa97BVH!k^F$$#kgQZHa+rf^g7jpz*QjdSK%{qKFQ@zXY82nKYzno zo3i%qI68GKW$83~ohFVikhkd-@XVe3nfriiVr+sBEuvI(5GYtR61%7=5{x+D#2%p3 zX>=rjg8<1Td??Du0FDczyx?GQdby*41cM9ou??Ll435O3_9}y29=(q8!86!va#3qL zA#6|*em&C1`_x60A#y}DbuB~fQl-C4(yI;TGPA{r)GbL@=`T$sk%*HFM626WQkl&h z&`WxwWU?4^DygnapQz#?YnrF9`oR>{{| z?l4Z8hB~AuhZMm8NX{~XQBvP6D3c;&*uJU3p4?_}B$~HIH#@V4GPy z9U(kiIctm{VhWa+XiZPuhPc*IBUm&_h>!rSl@w^+hn^gJJd2P({du%h%+p!oL6yl{ zJ$N`haH!j-CRdn%#uAjos)13iG6(!sH6FNl4OsGwl+X#l7VYI3MU@F7!O^jij&N*X zZv(}S*-`6DA{r(|;aEauIJrZ1Oew`Jg27vjJ) z)^W;K_oB`Meq|9^t0F^wB_B6$1h;9ZtD`#Mbf^&vuxNB8!@a8*Ifg5F;yt@M^Wwj$ z)-Cn!)ec=42@G!@>WHZ$!Mu=gMNg%+x^KL0)ieMf;S%nGtv-)fG4Xj9OQvITq?o$D zE#f&#MX!}M}-e8v6q%<@jRym=DreXE+EAOX#ti_)~#pm zFUBlc7ZJWt9C%(I6~12_idN>uTNHViW1Z!Q=;-9^$;9GhMrw}=pHtd^Gxdo~afGh+Gu(28dG3F77+bt|TzP-P1&#vwJ$M=Is+xoW=k=8m-RSK9N z-;E)`3zh(4m)MHL*F~uxl>jJT7oo(?(un1Kh=AngtDG%w*%B^=Wt_05|?A+RuC6 zBvi1YGw&%~k}Dn$f;b*Jo|hS+vrOJzA>V%dE2GUMne8T(r9!H$4Vzs4ih$Rt*1Dym zzKF*xHfybRo6VxpxJ^enn0l%uD7mVtyP{>NNY!Ckl*~rGWHkv^x8IcPjJeU}OtN2o zYLSWg_O|h%jk~TM1I)Lzvck4;^7zT=@pgCxoS~#k_-yT&^JfmGjglUfWv&l??dBe{ z-DvWr0%~hj&-7boH;i?)jbA#Z)2o3+6Z4zvrvFBaFET$NpE8YK0FAF9Ya^e+hz)7j zj6z@z=%`Tn@Szj4hpst%jZ9@o=&Pb~k!kurMBn?0?2*@;z{1Z;+95KHpXW4gOxI;; zoNIbiD8=)qrjN7XOE6`?_MI_%$c4SW|2;=gaTSv=UFDbBsdY zO!F8$Zyr-f;lqa(&O?T8K78|QqbZivy8lBo_pG3pUvmZsKU-00i%bXqO$B@!DfpM* zhx6J{e~(IBYGRi2LQ`H zZX5*ctu~vA5o5%%iRJBfA)qGj;M*mQ8;YjTUzoByT$+w-- z>J?XXyU(uKbK8UC+$o)pw3HejfljPzRCyT#s~pv*mC}`! z29*V<0I&F%Uci|82^ltjOu3Si(Mk9K(3gpIQVhO@kCu54Sq0<;cu(imK#3OLRtuodIfo1 z4i<2gr1)~-%rA=Pu1J`b%C}$__+Wb-6Mx0duuJT*w0pB))Ln;M$8KOEwIl<62Vu=4 z&=5gHh5*d8CWCgyj9e)Vq76(d>_KN&{WxIx%>7ouWK#O9s6~s4Q;^b0l#|ev8;yyL zlldo?I%R)4e(tQmu3b2L>D;C1V}}mx-bowI{=Uxky6SMqe$}w9_X-2DpR@B zTje&Xp9;p^22pD?;A)qLT$Ly_x=Zb*l5?}aWpXq)vT3NbN-*j5?qn#IicHoPe3M8; z_SPtf{*H2Qz*|;T=WVUk7;I?PT%Kt5najg2Ykd3d^CrDGZVx6s$xxipJ`FwG zRX2g(JK!tPKed17Ry+Er3NRmdi)qBaaurk9Zz`1GRpmUFHlN6xrYNPA&1ep)h;1rw zR3vs`HBk8m+Ye3|JkxzxJk@Kpm{ zTdM8bA^=l}!JKtztHdMvvS4kvuIAFk$}OYAt)aSs(Td>A{A}3mb;VkO7C^9{xnpj{Dol?(PHnkdR|%3~+YkT|W{rqkW`vOCM`+F- zFUZF${Tec-mOhi7uX`0|LQQJM&4NZ_>Zc~lxlR$C`6pusMo-BbMr50sEOF|7WIaTV z9-(d>*DcJQICAUJTPOF7Z3g1+;kHBBz8%)J^zG2R%C&86y*-3$R%gqtv=pwX2gn1j zdf_BJ`g_$St~V~SKgz;ZzDE!Y*9xLEg7)1ivA;Ey2qKf1q_pHufXpCN7LwCysA*BB z5dnOlA}}c9IM!8jzeSKF!#JAR+xxX@GnQ0@L?EfO7}sac0F1*DXF%Ld{bmRforTH) zBT%!9!esu5`8UWv9AXtcdq!Xj7tUNfdvX6H68qsO?`p5BjfA}AP6wJ0pB7GAO*I@4 zp%2Ng%P$qn>QZ-hL8fkLO87RT6;Pjx&>qXOwbt%b~;OWBb;Tp)^dS*5=ykc(lUjaS@XwfGDyZ!VWM>Kn)DM?c5ud zeZ!Y)^1;(iD?%Pcxz9?E(5fT?ASWOL#zVgg&xGnM4`B5U)Lj(c&;M?AHdQr6{T6h$ zQ~4W)YCCs!#|$UP3c{|;uNqR`g=}qGj}O%MC+v14FjqB*?IAC%*d6pw-0H9fZS{Ur z&}Xk`*$nH35{4@L^544cogu5oC$(-gSV4=CkeAKgkV6;mtMx9<{}O)KKG7N0+tBX5sZQF~ zRh02Pao)Vmq&ItG=P=hN3m20j9brph%CJCIYnzSem#7HaPfqH`_J74H()3nA}zIs%FVv6H}m>GP2O2 zNJR(HfXrmVM!{Y^V@7l1S(YqRS-E5>iwN&f0b{kN?ruc@cB>2vc&j#hoc2VOdt-G= z$fh&sHCoB(2t<4yheon%>Y9?aikK_JC96wv8Q;v`9cfF|H_F10w8EzII89<=-*~sd zWe+6WfeME`n(o}Nbzr#7Zbrhr+tS!K5+T8|`T*65zZfWJ=7rq+r}$P>7NA>zpE73p zkQG(X{}4570Arej(}E<1d>4wyQ18QzwwjdNiN1%!!Z5rRnGS#$KedLG1!aREm*w-F zhTBy^otp9m%Ys^dw-650gxm&?)+lMz4u8y@k(SVg#(=e9?`B1=grW3MpH&hK4tr&+ zOjGwdRP+aRUVph(ZL`}oJ0K(2G-!3UD1F#Q3l5yz*l!X)W6(T+_!_Sfly<}!yAa9B@2^rbUy9p3wG#_oORZ@p);Ne`OakT>5~ z`kpq6a!-%Ek>hRZ<@6mj^we%kd6}fMRaAGyb!8@RrB$P`cvC$|gVQKNX3UBH!*@J! z(WTd!%S`5Q$KKnYz1c5uJ|n+CaN?fc;&Ec(@(Nyz(?j4tkY|pa$h*s1#Lv6!8egnj zQrjYxCWpEr?lGEN6-LSb&^PWJbvXh~N$+~kH}2h8?hjg37@HN+5fZ<_2H39jgbUiI zsnLq5hscE<(+{;L8nrm16+|8KjWGW*B>+&}dcB+rjX6jy?|BRK1R>Zv%S=W#Af%NN zNARIv$oRy#NbxF1`lcS==gmA2Ocz%0zkJBI7CaR`m8LD@9@D5}8+J9fY^rtAPE?S5 zzMxGj-pyy%q*e@<3pUwlrqdmgjAilEkWSY^N_b>ovdxX%rLP6M%Xm20&|N_jYO}Z6 z!ok64UM1KQ?3=<_(4#V40g(c#+!#p~8P81E2nb&tvkF#Fy{sUz`R3}V-W9K`4;kHY z;cO~qO@uuS5obK;kmqaey4ojnOu(LOwWo`0gYY@wt>TZE2fc$4j|>5AS`hkB4g@Po z?v`w3X)iLrV^!r1-gWDHx2OCL5eqdI=f0rNU^2rL z)4jFCcf#lVKApE=d#_0iK&QTuA(u{F{Ea+jJU9C?e{Rqc#eI0_3@HUXF$@I$q(sY- zPg?4kO5LCM)+T(4{g?Q2%#-G^$D3eOg6?qRGMFHOFbfT6rrcT!EtzN+C?Gl~2#5DS znT*?1*imG7Av<9dw7I|W1Wo19a+}|2Do?crJXTk^OPq;>oY4xq!4<7YZtab_ENZ8} z3fF7L{eQmb{>W=(;tcLRi<_ARet%E__ZM-0QOw<69)8AcLsJ5i`BMJ<+bZPyk3>Rc zu@d*!U72T}VeiBE%hN7A5AK4Yo&X~#^@xuWYC_f#vRSI!WwgXyj3sY^Yl%c>;q!c) zEv!eTv`!~35}#yxl#vQ|ox+*9(~QjGZ5{KsCF zIgXMXqp^Tz!WW9iBD0N#F-uR)8E3~k(3D2Xj?+*1W06zMGpR@!#M(qjatk~2A6(&T z!C;oZScZK=1FDDzTFpQx&`~iyrOt=3i^Po8k^0av>>jjQ)i~6Y z$_YSN9zVw>k~*g+O=s>odehETKA^$D@}jgZ`m-^U=7!Nw2n8 z3{~Y8i^o$Lu)4ekcgj^2sXbX6tvBL=1|2CzvoIU1skb)N1Zx@{iF(reA`4u38`|EU z!5TWpo*#QW4DJ}wd|I1A8jT1K0)5cQAK){fpWB$EHmW7#47`{It;zuVUW?{uf|gC{ z1%be61@%5=6h-40oCzWvPXN&0=uh{ez!MezK+IiqK3m1<`_ol+8zGk++`ntb=%(H- zY8)7g_`S9{`<%SYQ%m~-VlN5=acqV*;w4lo5;EK#=Oz}T z;lW_Ys&aeWl}^3$$c{_niRKf3HFxahu}W|2jxJ9s88Po%A zQEQUyKD)lWb@ztxGeg1i)0L@;GNWFvHfkK<7U5i?u~rig`>UJX;qc{17!5>D(Sew6QyAlb; zHNb#11+xIw4Ti72)Vi<42q zWZ-gN1)&>cG;841X-&pVTIuiYLEj0lz_POey z6mof_F&zNGT`eK;O?s0?a65b?_fU2lNs z6A4)uDh~zbM~p5WD%pFT6PmB z%Ny144LMvolUdRyeK4LR{RRNaYia{_l^Uv7SJ!|We%E9XD(lw0^PDywGrkMy1 zim=-dMIMJEK+QM^Y|xnw$!msfk6|r9)L{HZ&~0-JJ?MD}1Pva##aln@4X%2f>Kn1`oaZ z>+o@e&l&VSe{CDw;KFURY&yyj^@ZcatuyHCc1v4JTpJ5^>kZZQ-rBGe6iHz|3}8N_ zFe5(nlpb~qO$eeS?GTYgdG;EWo_ zVP*+*?6iEW7NySox)gBBTo&{yr`(U`#_G3fu&J{p7KYE(oH9bixh1PXEs1ZmINfmG zz-E*524}duWz-dGsz{8qg(^KR7vdHtj262#Ald9X37sl1o)qSb4RRPD-;3LdJtY($ zzCQu&%N2$sq+1hBqy}aH}o*QHvz^b}St&MsrypfnRi;%p*{YkJ=CC2N#X5k*4 z)vRqB9CB%sCa11SuTyW{*II#FW7Ua*ca7j(1!ijpVMh93ZKA&Og0h zph>cVm`42LFkKxmSWO|5!33F%V_bb0R}FAmAD4wO3A>smGCUL5gdITc5F>2N-LTVS zsp0z{C!f^>V*qWQJzgua>19qJe4EU%=o*P4cMXHQlg2N32ihl5ZwpYdtFDW*db!(T z((9PES^gFnKih9&>+pGL`d!!=~ZK^QYQyZJx zTcVYyb}*-$Hpyfp2^GFZ5{mj-r2QD2Rlah}Vpp^&kT0TDR+Ck-I!HoAW`-}eOX%me z3RY&AC$Lix=7emhxJ&>^bdAQ!|60me5&D-iR^XL|)IK7lOWG=!Gw@c@zI8RWO4HJ| ziqN>Ct%Bze{CJKU2G8UoTSX0%MGflYo+lQm<;Dv2&L}iivT@fuQ^j9ks(2H%3GZS{ z<)=Ypc4Z6|ox|nz`prdl3IpHN;9DoVt*+&&Iiov2$Wx-Wy<%9DK zm1PcJ+EVG@0Dc*>WYw0+ooldEe!nI|h1PN=lye@|r)y+8g+ccLtbpw!1BIKKrV>_4 z2aKx~t(4SCR?6hcMha#ccxV;6VWWJez(%Rgm>i326l}b7v>T;;1gRf6+kiYu1PYZi zITjl!rOpG!QT{1KR!WI;mN8T02ocv^t1(lqU%i=PT!ocF{u$C^G0X?DQ~tWZPT|%^ zo}Hp16Gc#AMrgI!6d&18iDEhw7%C-?MRjm#O9fUY`m7XOcv(}WgB1K4OqHkBV53?2Oi6q_|dVq?}!=jbg;OsxU6HQJ#@)lxp}? zAt8WTqL3r)ImlFj0fvdFo0Kh(32cBJ>WtxBQ|b(cl!;QOq?`EB9J4ZW0}W7F6niCe z61Q8F+pJ)!P$RB2nJPD|#Z(zslcfTai`88DwfG9`z5r_gKFkC=${vsrRBQ303MtQ% zWrlo#aCL2Kf?$YMjftQtIQ*_Kopm-+flgGUiu`?DLPXew{lJ`I&pux`@;FDV>y1^aOwOl z7jBt5aqOC@YnJDo>$T@yY#F{j`C9T-IP(9H<9n791{G_Z+FYj262oOIZHLm*lo@>CK8b zzVdcqxf%Tr%j|V7Z(ezyA@lNfg_qZ}&!i>d+%>yJ$waN)$uSD2pTaq<#-zdOW{`|V z1019lIEHkZeXt!QgGrJ%lnNt_MmC{0XY}zv;T25ay=0UOh@7qV8c2s791z&Wg>z@- zPFyv0_#nZO4_rTZeLjDeQOzsxcYWKNb#Ywy{2Dez>t_A#HSMOzNknt{f$W^VFU_a( zUc|OZ3<&ugMzJCWItd;;Vmx^eWQGIg14;9S?9{C~x=UulQ9Uf%ur$(6U3SUHJbw<`QP3@v<#&7`Mj?j9Ty zVF@AqEi-Acej2p~M50ZIaT;|6^OW-7G!)Q--E`*k(Idz>KY#ktnM=oKj?5pO-@S9w za6TUpSzad}czN`iO!swhMI2nMy}xemytuZF0&FK0OMzGa$Ze;+>~^6hEgeH4!1gBK zebVG218Ng9n~Wwi7IPKKpJ}jDgtwBGD1ax8CA}^YV zR8MHEimsJa_Sjl4$5&sI$uiC?7TCrGmrQRfyqW|1WS z{^G*<+36#PcJJ6WHiGQ=?#>#tmky2x%M_c)7lr~j6wuMXd>#x6f z{@nbj<1>?cc8qViZS1z;!Ophkrs`yHv~pCIX~)ts9b3&}wNAmmb7_fgT4^D>Jhuj! zUq+l~R$AA@rnSgB*1#xa`Qu!cyHSg>hutgmrcHOui56>T55`Xe&^!+tzwPE=F`! zURTCThtOaobI~*^%;*8FGxUTOlX+(4M_l%b5Xt7ry<=MlvHtEizw!2)ZoG8e`Ez78 z@4a{OUWn$Nu{|3HdPaLkn;N23vS2!w5zMu(-s=?82bL65(Y)G~{qo7zMqF=P(?T!Y zvqssCLw5g;+i$Y$zFFu?OE(KrPIM^-Kgz5Y$zqjeOeoE@NC%j~XfYV4nGwRIGQtih zl3gs|0#Xf2i7o{a#xoaWKs?6vOa>$)0CjxbmrYL;T+uZBsxO%@y|>?b(~Z|(ckcA5 zlQYvt5AS{Rb%OJhi^v(2d%71;cF#T3O8$^CRH{YvT{0wz5Id6(kxwOv$2jyKy2x- z#?IG*eeYZ{Hu9Qr>;5HzEW(vPAQt*8_|wf0UulYHRoMDb_8s;Nlm$pdnFvORaIm2O ze}dAvc->QLb0QY-8TIJ3)0Js7-`ZaP1b0#ez)uGB^4@eM@h67_A zCM)ktf3wA+cU7Qck25IwJ}VbDQD4AMiw~dCqAdA2&b z6~~coEXbj5CD2rs>s^O*7^Jd!K$*Dk_D!u3DPi;2yn%3~+`hPaV?|s_SzOlgU={T- z{#0V7-xH=L#`AJVV^w^*&mn%**<`hP3=-NQXf^K$qNci4zOeC!=!-n`*e5NdJDvh@?Ly(pdcRgtnpH&$%dv0o2d`IOiy-hf!MB6A_P zs1XPI>#8AhpfrNOG`&=uu3YB0prP;r^NUL#+$oC8ZEURfdtGIaIi#;a<}_7B^3~E@ zMBO}*i}MsLiXubkssuxOA}CdxT~@m%;0}yj*xM3Ka4Gau1bhZ>&EVm2lu(!~$>s`4 zI9Ai_*9(Eobs7UQlemD@#j6gs_g*;AVQl9z*jN|b+gUlbWu!eMOx2y)sH#g3mupQ& zl3jgny+v1jvLCVnnd3B3ZBS@(m}IULRdgyHW};R_f+xy?cY1{edd7QCp~ z?G<`8nZb*>B@Ez5)Snc2v?Kvq9THfS1q{{V8K{e|_q9{1d#XZN#Cp|wR1RBYf~ZFI znMG`~MkkX7gfRM(opCF2%K19xYQ1&bts|27wp9DFi&O+a8M4NsK9gSoQkbNzA66b1eV%L{N(UZxzzobE| zuW`6MsM9uEE7dx$HXDq3qecyPqDp@>lYxyR(9GoWMY|^9 zbD=+jII2+zCi}OLacFXi*V#4<4Z757gT>R?)9Eo(G;Zy-=$uZ|mfGf?kiplnuRm7p zwR=-Bl_r<7?X>HfHuML7sdGAv4ZZ0KZ3LODQHzbsd$(}A_(}0gpveuO$+0c3nkGaf zs%Xe|3(V9vWX*ZGU{*W~Ne2vAA&ImY_UcG+pjhwFpnH83n~w!rEq0651lSFWJM2xiLvQH96%x|tjdrUuo(Lp;66C55 zx$xJCFCuHAlMp$Qz)OS9zXrDQ1Eor_BoKj<%*o!YqkL zsvLlrEklleTPvleavMk~{h~xwu0-kEglr-rDNx46uA7;vbXfEzTO{m=v_*&0fOImL z40=b1;-oMlyI@R=3mc z#fg(nkJ%WeIn#u(y$*zZp|VVWHG-`(^+M4 zRF44l*OJ;4bi!t>c6iJhhj5!a(H4vhwuVLq{6js-Upah!;}%ySBn9v&c$Q}2QQ-{e zY-eG{>wXqJi&FRF_d3F5;pLyjtrY%zCet6soLVe~jaH-nu@An-g1V9DJoew8(|L7`&oaSxO!90RC=M}{bm!s7#C zbo2pHc={Q=9^@QD3E+z`kAaqeTo?n~rEFZF=p8l&Na`o=ZT+G{p?dB8{4_2(Qt?>? z!_~REvnW_^;#bJzAp6sl527_7|516iq8sv>Jo!w%t%MLGd6^ur!PXXm^>()mwhq=- zrxI16%0RixZiUg+EHoi{7|sf53ET9zoE93gm(e{a})BgCb zHy-Qgu!%OSuub06+-1C1elsb3M}Bj8vSmZq*w@CNHGPsP{Nb4ql>n zPqt7m7!%vux9<)f+|{$|U}*C$;;R=JMIYdN?PZ(NLjjnaWCUc&evvsxsqm;Wg<-}k zs;F-_=L$M15}rjzTYYUjTJCn(jXIE^8D$fh5urHIgB%>5o=#Opg~@a@yXyrNhr0&? zkye;+gJ*%cR+H-M09tW1A0Gct#S5(XI%URJ1g!^>vk(AB;3_KhR7zcO0@T zV9fQ%{MyMLd5U0#s1n7>g^HuZAg>O|>uj1tKt$CDQl54CaTDCC+@s0~VCk0-isrt5 zhXLRPU5fx_R(~!kZPWdY4b+;je`k7UXM00mV;?Gb!U2Do9aYiwLOqHcWegfxmkET1 z)}6vq6eY)BC&Mx-pUPyA73fm=aN$u`rQ4>{8q`|7T2&UT_WC;N0;c4azTu6Hbyf}V zXI$lGb){|m%t+|cx$$c@hi`gv@9Vb5T93bDdhd-p;_WB?^1rbv02IdVu&dQpr2i)d zn|)h`8oN@F2)fq#gOx?tRv>BrciOyjJf$)kHg$-4#Fb?!ApbP4`5>Y zb*P6|XFf>aS4KLaT@y zRgv7jEf%E`>OH%*9o&9!7;(qu#)i7+*4UWeYm3+;auGFhNr<&dDI(Un#XM70(d3~b zBp8+CAJKWZ6cA5=qL6?vlvTl$%XYmNu3v_GzCN_L*Xs=0inM!pFpO6ACa2$O_mx?- z1}khYSYo{vhe~u<>@G>|-n%>_|NONE>tt)sNKDcWv{w(<(-FPOY&N>04L(s!GzTQ1 zPE}SH(3l)fy~jyw35r$O3E_)k4{K!mpH3xt8I#N^H|pO}6b5sGP?=;#I;jYfY;&d> z%l!<~o$r2CY~%hk>R;<>;?aQL?SzM^QD`KGOl6eri<0BT8*c0q0dC}!wrrb7*4hICL>+6ls3Flp1xO#rj%Z5nPKDx?s0 zlxv|7fFfloW*=UtS|!ac|8(&%KeQ?;erPc*1mty}5WXYESr0>Rv5u5aLh3v)>rjS) z8aPT0vIuFy=B^C5%23UZGv=?#@#>(KAfccUu9GwIZWWWak z2x7nnidNN$=9)49)Md1xns`jS?$Z#`Azvro=PkDaYPlZp84jztv8S&ig+wzrXpB

unA< zpW|^n^E-3Tj3>)JGu{)n5LaICqh|4xY$a2loB+RJ8WL5m{r{I!$7e?ZUQJxDF@iYSzIAldK!4AX-Xj?TAvCZC z0>Oso<~gmFpt@$|i)C51n+fOs`aiB47_ybK&HbfQpgVm7gcN#aASMQlO()gAbqwic+76@H7? z^Z5QSUhl^Hm+<#2Yf;^ezmMa!6|XtG-p0D{Hz9r=<k}AH}`CcjdpuTW~F)FyI_7 z?yFUO0?&y`TRd+WezOR-;`#4Kk^awc+(}l0XHSU-am*xhicNU6;TbnFFZ=(Pn`j|; zSXl65oX~Nq9z5&oF&;Iuij~;yH4U30xz7Nm+w;012RxMt|DnR2F(Zwv{hnZ9OEa>prE58xSaIOQ-HH(lA zU3V+Scb07sBUe5o{2$!+w|Itw%$84Iq9O5ycz~CUy#d?fFXHuMW`xZX7EXdLZ^JXZ zhgE{EZQ>`GOT3JGcd%;pJ6VhRPP~q?Ao}jKi2oa}F_u!_1=@cZue(5}e`apsHbp)l z7sP+!E9WQpC?LkeWk-=2E+32dpE;JEmHl(>_{G;kcr|yeIXpjJnQLdStH@O5np{q& zA)|}#nV}2GGkX-*`bYNH!k@vHZ$buTS%-ZBK41*&OUiv{JS6v!d6Hw2Ver#OGR)@y zotK**G5#IRgN&RLFMbVKy8*l&z7*5{)_a`;#UxSBz=|t>VO_1ef9ue^mm09>9qV8*Kefb zl$Yup^Qk@nxp)aL%xl%#A%}M`5A;+ybYH7*1^VsID?7nc8(v+|#a1lD3I2Kzy+gl? z*Kb)H`#mxre$RBmSAd=RRbY;O758|M#Z;9nplZ4D3wj9$FsEK-5$qwNLJGKAo1mN8 zAVb3}#V%vcbmRMBV7VMZqV3B}kK^=0HDqWLc+>_*?l8W;0-p3T1Kt}|W>%wKz}$M8 zHHja`>p8qWiq|i|@9(mh_$?L{f5776J6MD8(v?4C`9b=K^bW02_u)E-vx?utj^!@I z#qL7<=tkD8dKYByud#AQSe#zMzk@Czj2{@%!vDqk^h2Nze++*=j^CbuzNR%}(F?O+ zv+~~yLbdRq@H6qG_@MYB)k(Em{jjE5bAz@*`(@n$-5Yd2)*sXV$Z*W?vT?}xg5;AP zGQ~}Im__rG7Okb%a-Zdk)}7Wb+T6AW>{a%=?SFLK@Ay^O-m-_we&XEXe9+bD`jp$~ zo_7D-Gvs-syuSR#@)y13-p70+zUTZ=|DzT46?a!WiU0l>I1+eY@Dr5_pdZI87Nc8Hyh zuFmeE?%(x%wD-0RTl?z!ll^b#e?EOY{qupR2TyKHZv4qm#n2aqdxu{cdB>*crY~-u z9(9bqu;tX2ACI}mp4-~E^R^*_7e-LKpIx-Z`7zVTZ(oxJ(^Tb#H2;noLl z``qmhz2V+BmcQ}7JG6J)f5%Vmy#Gyadh^U(+PmKUmIHV1zWau|AH4f>_vr6Q-*f7o zci;2uJ-@lP_TKmXMfqPmaG&kIN8Z}~*2nMfz5n^QJ@UY*2Y&GO`FB{}@%TFj-}$G% zy#HOkcir}`pTB$WyI*?G=J!1JR}+8r(t8Kr`?dE?zkmDtFF*LX4?Osg`=KX4SpUIG zAN=BnoF6*(p%*_K{qSFY_>T{7fB5;o-u;OCk$WHc`A3d_{I)m);|5>Gxz_mHNa?2+l`&9H(4}CiR>5o2F|J>I>OMX8C`W!VOv5_nr6( zXYhX|_D?T0Ww@SHmv&j`Ci^2H1Zn@3qV!0FsJdN5}f0>*V)(=)+6O zdjsCTM|p1)I)&$y_Y&|Sf2X`RK_3CkhhN9c?o-t%?=8^dpH|*GV0(TOJ8ks7#-rD( zexSS;m|J60-iyql;W(5yMg_3vR^@v&j(NB8Uc+wFJg&UgvZ%IMd9PzPYWFJd^=w4@ zHRZj5jp)ji_eSxY?uhbUVpWDOEALHgtKpZ*d$SNS_A2i!tW`R+@$9+l&(EDWxe!WT zl?pXCHZ|9VCZ?w6&xS@%pPQPWpE^GmN?yEpv3@S|vHq&Fr*F)DN}o7AH8)S+rD{Vv z&(7dlXG0^`&YrnpYJP5JNdu@?=XCRtKhxI zdO`~e$EVOd@8lfro4l^EzN;k_s+$jWhU(6T+8RT3n{YntCh7QVYMcjC;2(A=5Og=^2vo~MTcZEHhx2pxO=?CB}|ws8L1s}`<3KYM|m zoW8$me(J)7xvQq;LsRqTPEJkZr1~sv`Cw<}E}Wa6x;}IqY^x1TU%L>RTS#08ojJP@ zI(6*@e8TO|%-{(Y&W5IEL)TuwThM-b?nEeo`%Q6i!*6uA+3RN$p@q4H`B~g$*W8(_ zW^pl$gNO>QpO_6@3Z0y#GivFFtMJHqm%MQD?D+)@`25s~^Hb+e^3k53ou68myKZ*= z`p|{bkl@ht*_k`~Ryj4D+Hk6aXruq=Sm~t)`qU$h`F!N?Zd~!@7!DUBi zYN0!Ha$(_IcSFO4tIp4z11~OMx}80LqG5bw>(amEi9XxN&a!jtdUhVD*(caZw!lKL z3a^3%7(!M`BWuFHwRk_lrjWchkE27#^g4}mrtoPV|I(Rs&PD!TJw7e|wI0_yi*Ii% z@mm^qJ&mi(;aZvFQv8lPan6kLTy)nFb}gGlm(3gao#*h|RKb1Eqq{-z5rx;hi2E#H zlp$m&%raC#;QH6$-x+@Wv$#5qe><*x8sE~W&*JX_Kk^Koukdq-jpK}2eytO@w@i&3 zrHbiPi(~UgRccJw=`3*{`X$4Y(oeD%PjenmJBPcR!O=~4=0?uN9(-EBf5$PlYw`Ci zs4%CDHwhXv;>a$no5c4zj3k6LnBJYozis%H-fzOcbbtBNC46c^WQ~5gh<~f_d)1;R zm+4biM4^1DhVUF0a6WN!0r#5%H)gp^oM%_#yR&%amE?~kw2-o;<%Kx7oE)$AI+yKTFlS|{7cV4ypU<0IsPgx*%$E39FC)TPuHBs{pbm&l{?kr z+r?6u(JJ1i$|o{7N(N6n?qD-(^Nm^pI&lGECajg^ho~|a#R8G6e=Vit=i>H~zaYS{x|2#fjz+4CcX_)SL6~8|HBJ(37 zsq$Pu!GEQhKpe~5gT^GELDV8Dmww6%IO{BEPS++5lkA`1{}N^CPBL$aD|A14Lef_A zoPrlP4@n2p^+~JD;kSJ5%>q+`u1zC8i!rUNp;tbF#+Es1d5yapW03hjg1gI_br;?p z$Mam|qb1JCN6h0dQJUt1%*Si-o;XeVC&Q~;gFH}f=8pt8Io$-07`Gq-Y(o*KbUVh8>bPe?1%y19U->Shi2?*hg`tKvC)N3ulo zhE_M?^$Gkwj`O#!>m1r0@&8?U3YxgY|FDmuoMEK(uziT>#T_h1LW+j9Hn)bH*?)Qh08%0$Q*Nbh0?^+5w$k z$19h*7}YpzKvh5wV)A9o2j5f$^D_@ChX>w;OkPx-AU55d3v z33R*~M5ds`(ufwl69FVGGH&$j=j^`(gJ49g=@`)CUSS^+B=#nDCwrLP#{QoD1n{zE zB$HSLn_x%oXc_xHJe|*>2hm619X6vEgcDeWZova&QLo?wMr?&Ze*V8<_p)1Ie>}@B z2$kT)J?tiSy%1tQ`~NGu(&)B|D?C@$Vl7UAB&J2QJmtk9L{G+c;>4j2iM7~qVq(XR zi4-W&vn<;pjud1YC!rL2Xih!BQr#MRI>;xM&|D`*wgo}baV z*dx9qUd40LuA=jB_Ep9$riR!@F>1%X2k9g)YU3@n7jO+Dln7X@YVzNqL&0X_}z|T~7OGmiAMT zN_2p(pfb(TJT1_b;!g26R*SpDqqHb;bdU~-N$jovMpucG^iH~(-X(rb*U+`}ZhZQX z7f;~c?d#}0;xRgcr)0lZ{DrQk8>oU`3b>JO!hKjzizmf1^Z~k=ZV^w>2kBP&5Pg_# zqmR%>>0|V9?4GCS6LdSW{#o%neNx;_pQ2BT=jaal41Jb9N1vxJ&=T; zzD9S_U351|%#Iht52;E==@{KZ_lg(kKKeQxr~By}^ZX-B_`Zj%s9;EN$tlcMW z!zU)+#8+xIizDHy@*c=n#CjHPxzGK&-4<#EZ(3W(JS<0@tU}Wej@ImpW^d{ z*Ts$Wb8$O<{pdO&@mQDli3*-V@mq1L_?A<8`Z^R{8&8DxO_%fe;w*Mwg%mZx3M1Hok7{tbWziEkc4Q_K4EW3yYQA$V<~tjS19Ke_D{{`4+e7$c&-62*0HyoGs~r-ch(|Bi{upvPS^Q@Gj;4& zt?lOQe84pE)=Ij{_Y%d=gbasPr7E&ognm1?M5L-RE>Swox`D$@SB8sY>|bxl)yr|?(s?l*IA zl5fGL*!in6PAn8P9hz6s3gFNO@!_EQ3RaVMVZJasnfD&DNZuj^MWA8U&WdiEuJK}BPe1o=PuCWylT8alP#e8yQS2Vf^t}bl#0iBa?0L9O zm1fq>L4gm|LNq%F&x;@DpUAzkQrIduw;e5HIP6`X9a%ifwP_7qnn&uRObA^Kr zZkfXrFV;%xl+G!IiiKjWlagI1PO$;yAXe8Jo?k3ExMh9@?~qPOSx_&)0;j+hIM}kF zR#Fx?C1rtAXok}HnL>He51`m){Lrnc=0ZxdRXZ1)f-W0})Bv4^;W?a)®(s$=i0 zRmEr7IOyYZR@=AT!Aw1R-i-AYm{Cc<*Y&u(Jb9AuQ$OY3SHuxq=N`eGrowf?wMvMS zn_SQ0yGAEm9Vg#7xk=zc#E@EcDkjO$CN=rsh;*;oBi*S>(h>YPZY8bBk&$#nZpnl- z*~6$OlhI@#Wlr)pc_Tm?KQc5TJDB6ak+e3YRVpS}M$%c-Xo`u^dPeKB;Vizs6_z5J z$>>syr1P0fOu7sWa@=huOzXJn8|qbLPYib=nr9e0Zfe#t?L3?;H!C9BDh z9@k?sU{pm*Vmw`KX-Pn6T>7IK9*nCkZjYlH0Imk{BB@o^UxodF@2q4^<(S>PblnDK0!pL~vP524RjTwJR-Tiyqgqka{m3 zN`!q{JYLCG1Ma9SM8hjEst_21(U@#8s>F1OQFSqWlTmGAdYVynGd&&dVtR&A^)g** zRDDdB8P#T{%Z;j^X{#Z9(f?8Rnb6&eK5vF@rf-36re{Gn(=c>1JsY~2z7@Kez74vW zo&()XHRxs-AO6k z?9sK#c>13!!`y9U&85^T^)-@~cPJ0GHIDeyrd5X4t!B%)hLBBG-eLkc`WTAVd(`@n zyio6{uA=3zYPF&D!UBgYi!?BMV)8tr{mkB&T=Q>Q5&RrDqVS(+ZPVJd0X3IgZG)A{ zfIgs`6Ou4P*ATvN4+RFMO)K&a|5dB>rlR>uyRK=y6^Mz|o3(bufR%u!e=4fUEKiRu zJJZKpT9Xz&=33QsRwf=tI{Pv2p$f|M{;YH-kfWF!B5Ex@u0(cHmrV(C5=rk$m|@^- z26F&xCKO|l)BDYyunsx>965hN$$|(=6f|IxqX2hAr3W*@!+p^YOB-fBOUEmgw6Gq@ z)FmQt?K~b0Iy|fF@#wu6=J~2x`Y}H=tzU=BqKJP?cBtXQGMDWgu`AuK^9w_L_`P1eu2!wMovx?wyd5f+TbY0r2$5gfE>|P^z5k(p6Y`suEtThi=R!k9LAniT zL>=L$*fnSz6`~skZUZ0&+l{06HEn<)09CWzkg;e5NyXVy!OZ%X@gbb;as~Q~v$*vD z7qd79yICBAG>c=fLB)l$)(InLBxbkPj;Uk0>mru30n9sC4ufHq!(fEvFzCT*fi<@_ z1)PZd_Z%Pi|I(U+$qP!a-V=^Aq*x?lTieIh_Q0e#TgxE9)-p)4wG6fxoS||v;6{#y zlNc%PyAieh+?T-s_hqn^`!cwI0}$a1{2M-K9$9TQ^vaq-w_x=Qr^ z%>B(cD9UMAACq`X)(^;KDNRHBlAYV7cWh5ut_#c6nJliM#<6fYGhDj#|uE)j9mh011Z&MQMJ4(2I;36e)*_Am?Cyz+? LO;rz$ZH4#;GgG2( literal 0 HcmV?d00001 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf.meta new file mode 100644 index 000000000..abf2e1e9a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: d722354f9c8e9e643b5f30f00b5b20ea +TrueTypeFontImporter: + externalObjects: {} + serializedVersion: 4 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 0 + characterPadding: 1 + includeFontData: 1 + fontName: Poetsen One + fontNames: + - Poetsen One + fallbackFontReferences: [] + customCharacters: + fontRenderingMode: 0 + ascentCalculationMode: 1 + useLegacyBoundsCalculation: 0 + shouldRoundAdvanceValue: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials.meta new file mode 100644 index 000000000..53636436e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ddc21e094ffb34f4389bb47b77d54f47 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat new file mode 100644 index 000000000..c63ee1227 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat @@ -0,0 +1,274 @@ +%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: Color Ramp Gradient + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA GRADIENTCOLORRAMP_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 28596166879787490} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!28 &28596166879787490 +Texture2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: z_ColorRampTexGradientTex{"mode":0,"colorKeys":[{"color":{"r":0.25045204162597659,"g":0.0,"b":1.0,"a":1.0},"time":0.0},{"color":{"r":1.0,"g":0.0,"b":0.3670511245727539,"a":1.0},"time":0.30406653881073},{"color":{"r":1.0,"g":0.8852795958518982,"b":0.49803924560546877,"a":1.0},"time":0.6081483364105225},{"color":{"r":1.0,"g":0.7620869874954224,"b":0.0,"a":1.0},"time":0.6730296611785889},{"color":{"r":1.0,"g":0.21687757968902589,"b":0.15294116735458375,"a":1.0},"time":0.921126127243042},{"color":{"r":1.0,"g":0.9718939661979675,"b":0.0,"a":1.0},"time":1.0}],"alphaKeys":[{"alpha":1.0,"time":0.0},{"alpha":1.0,"time":1.0}]} + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 2 + m_Width: 64 + m_Height: 1 + m_CompleteImageSize: 256 + m_TextureFormat: 4 + m_MipCount: 1 + m_IsReadable: 1 + m_StreamingMipmaps: 0 + m_StreamingMipmapsPriority: 0 + m_AlphaIsTransparency: 0 + m_ImageCount: 1 + m_TextureDimension: 2 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_LightmapFormat: 0 + m_ColorSpace: 1 + image data: 256 + _typelessdata: 4000ffff4a00f7ff5400eeff5e00e6ff6800ddff7200d5ff7c00ccff8600c4ff9000bcff9a00b3ffa400abffae00a2ffb8009affc20091ffcc0089ffd60081ffe00078ffe90070fff30067fffd005fffff0a5fffff1661ffff2263ffff2d64ffff3966ffff4568ffff516affff5c6bffff686dffff746fffff8071ffff8c72ffff9774ffffa376ffffaf77ffffbb79ffffc67bffffd27dffffde7effffdc6affffd54bffffcd2cffffc50cffffbd01ffffb404ffffab06ffffa209ffff990bffff910effff8810ffff7f13ffff7615ffff6d18ffff641affff5b1dffff521fffff4922ffff4024ffff3827ffff5d1fffff8418ffffaa10ffffd108fffff800ff + m_StreamData: + offset: 0 + size: 0 + path: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat.meta new file mode 100644 index 000000000..b6464e89a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1c07bf10ccbd5c643b7a3d99b400a745 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat new file mode 100644 index 000000000..d1162aed1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat @@ -0,0 +1,275 @@ +%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: DemoGradient + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ALPHAOUTLINE_ON COLORRAMP_ON ETC1_EXTERNAL_ALPHA GRADIENTCOLORRAMP_ON + HSV_ON OUTBASE8DIR_ON OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 28726713437276524} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 77.9 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 0 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.2 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 0.97 + - _HsvSaturation: 1.3 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 6 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.037 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 0.2 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 0.66800976, g: 0, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 0.7803922, g: 0.3137255, b: 0.94117653, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.6425381, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!28 &28726713437276524 +Texture2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: z_ColorRampTexGradientTex{"mode":0,"colorKeys":[{"color":{"r":0.0,"g":0.0815119743347168,"b":1.0,"a":1.0},"time":0.0},{"color":{"r":0.3421383202075958,"g":0.0,"b":0.6415094137191773,"a":1.0},"time":0.24681468307971955},{"color":{"r":0.778521716594696,"g":0.5283018946647644,"b":1.0,"a":1.0},"time":0.4923628568649292},{"color":{"r":1.0,"g":0.2666666507720947,"b":0.8437959551811218,"a":1.0},"time":0.7340962886810303},{"color":{"r":0.13333332538604737,"g":0.21844977140426637,"b":1.0,"a":1.0},"time":0.8664072751998901},{"color":{"r":0.0,"g":0.9796860218048096,"b":1.0,"a":1.0},"time":1.0}],"alphaKeys":[{"alpha":1.0,"time":0.0},{"alpha":1.0,"time":1.0}]} + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 2 + m_Width: 64 + m_Height: 1 + m_CompleteImageSize: 256 + m_TextureFormat: 4 + m_MipCount: 1 + m_IsReadable: 1 + m_StreamingMipmaps: 0 + m_StreamingMipmapsPriority: 0 + m_AlphaIsTransparency: 0 + m_ImageCount: 1 + m_TextureDimension: 2 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_LightmapFormat: 0 + m_ColorSpace: 1 + image data: 256 + _typelessdata: 0015ffff0613f9ff0b12f3ff1111edff160fe7ff1c0ee2ff220ddcff270bd6ff2d0ad0ff3209caff3807c4ff3e06beff4305b8ff4903b3ff4f02adff5401a7ff5a04a6ff620dacff6915b2ff701eb8ff7727beff7e2fc4ff8638caff8d41d0ff944ad6ff9b52dbffa25be1ffaa64e7ffb16cedffb875f3ffbf7ef9ffc687ffffca82fcffce7efaffd27af7ffd575f5ffd971f2ffdd6defffe068edffe464eaffe85fe8ffec5be5ffef57e2fff352e0fff74eddfffa49dafffe45d8ffeb43dbffd141e0ffb640e4ff9c3ee9ff813deeff663cf3ff4c3af7ff3139fcff2041ffff1c58ffff186fffff1486ffff109effff0cb5ffff08ccffff04e3ffff00faffff + m_StreamData: + offset: 0 + size: 0 + path: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat.meta new file mode 100644 index 000000000..a329baa98 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 473fd0e814452c4488d6794c3f24dff1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat new file mode 100644 index 000000000..2c377e9c1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat @@ -0,0 +1,188 @@ +%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: Fire + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON GLOWTEX_ON GLOW_ON _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 487cb2374bc49b848a1f4577212201cc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: be304275dbf36014ca9828884588ac47, type: 3} + m_Scale: {x: 0.6, y: 0.6} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 0.488 + - _AlphaCutoffValue: 0.25 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _Glow: 30 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 0.1 + - _TextureScrollYSpeed: 0.1 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.5103101, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat.meta new file mode 100644 index 000000000..1fdd24f58 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a186aad8f5f9dd04d910c7e3174834c0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat new file mode 100644 index 000000000..f1c827021 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat @@ -0,0 +1,189 @@ +%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: FireSoldier + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOWTEX_ON OUTBASE8DIR_ON OUTBASE_ON _GLOWTEXUSED_ON + _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _Glow: 8.5 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 2 + - _HsvShift: 151 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.011 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.9703183, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.29168093, b: 0, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat.meta new file mode 100644 index 000000000..dd89f5b3b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cd0693e274874cc4f8ffd67a41ebe801 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat new file mode 100644 index 000000000..19dda0651 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat @@ -0,0 +1,188 @@ +%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: Ice + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON GLOW_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 0.55 + - _AlphaCutoffValue: 0.25 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 1.5 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.056 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _Glow: 0.6 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 0, g: 0.9150943, b: 0.8972679, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat.meta new file mode 100644 index 000000000..b65031a6a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e4599046180b0ac49b3df99ab01b3e27 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat new file mode 100644 index 000000000..beb4473d0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat @@ -0,0 +1,209 @@ +%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: IceSoldier + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOWTEX_ON GLOW_ON HSV_ON OUTBASE8DIR_ON OUTBASE_ON + _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 4.5 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.62 + - _HsvShift: 271 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 2.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.018 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.09103775, g: 1, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0.06866193, g: 1, b: 0, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat.meta new file mode 100644 index 000000000..0973c3578 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d27799974f79b894196aeeef8bac53af +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat new file mode 100644 index 000000000..35a99a0f4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat @@ -0,0 +1,292 @@ +%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: LitFloor + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + 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} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: fd279c0d74378ff48b61c27ffc8873eb, type: 3} + m_Scale: {x: 8, y: 8} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: 47c3680e2892fa44b80abb6447b1a619, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + 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} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _BumpScale: 1 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _DstBlend: 0 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _Metallic: 0 + - _MinXUV: 0 + - _MinYUV: 0 + - _Mode: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 2.86 + - _OcclusionStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _Parallax: 0.02 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _UVSec: 0 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat.meta new file mode 100644 index 000000000..be4f1ac48 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f967997c8b2ff004ebed845351a5449c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat new file mode 100644 index 000000000..645310607 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat @@ -0,0 +1,245 @@ +%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: LitSprite1 + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ShaderKeywords: COLORRAMP_ON ETC1_EXTERNAL_ALPHA HSV_ON INNEROUTLINE_ON NORMALMAP_ON + OUTBASE8DIR_ON OUTBASE_ON TWISTUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 7062336ff4b66994caa2ba23c8651342, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: 994e4deee74379d4c83bcf0f27585f73, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0.051 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 7 + - _FadeAmount: 0.169 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 13.02 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.102 + - _HsvShift: 360 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 15 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 100 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0232 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.32 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat.meta new file mode 100644 index 000000000..035779a49 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a6fac1ae6d53b7245ad918865e14c52e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat new file mode 100644 index 000000000..982629dae --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat @@ -0,0 +1,244 @@ +%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: LitSprite2 + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ShaderKeywords: DOODLE_ON ETC1_EXTERNAL_ALPHA HSV_ON NORMALMAP_ON PINCH_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: 994e4deee74379d4c83bcf0f27585f73, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.184 + - _DistortTexXSpeed: 0 + - _DistortTexYSpeed: 0 + - _EditorDrawers: 7 + - _FadeAmount: 0.169 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 13.02 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.213 + - _HsvShift: 221 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 10 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 100 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0151 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.139 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.42 + - _TwistUvPosX: 0.316 + - _TwistUvPosY: 0.755 + - _TwistUvRadius: 0.54 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat.meta new file mode 100644 index 000000000..3f9101feb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c597a6bd515e47a429c79f272eb6762a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat new file mode 100644 index 000000000..4517694d3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat @@ -0,0 +1,245 @@ +%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: LitSprite3 + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA FADE_ON GRADIENT_ON NORMALMAP_ON RADIALGRADIENT_ON + _GRADISRADIAL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.3, y: 0.3} + m_Offset: {x: -0.16, y: 0.08} + - _GlowTex: + 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} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: 994e4deee74379d4c83bcf0f27585f73, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 7 + - _FadeAmount: 0.275 + - _FadeBurnGlow: 250 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 0.609 + - _GradBoostX: 1.02 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 13.02 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.213 + - _HsvShift: 221 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 10 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 100 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0151 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7.9 + - _WaveSpeed: 10 + - _WaveStrength: 18.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 1, g: 0, b: 0.6043663, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 0.044267416, g: 1, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat.meta new file mode 100644 index 000000000..08099e014 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 23a4e6f17bbaf66479862eb488f28181 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat new file mode 100644 index 000000000..a9b21fece --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat @@ -0,0 +1,245 @@ +%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: LitSpriteTransparent + m_Shader: {fileID: 4800000, guid: 4cab4aa8ce3e6774aa0d904ec70df88e, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GREYSCALE_ON OUTBASE8DIR_ON OUTBASE_ON POSTERIZE_ON + WAVEUV_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.01 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.023 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 5.1 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat.meta new file mode 100644 index 000000000..146aebadf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2d686b7701c352240a308c7b5da3d710 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat new file mode 100644 index 000000000..5997999a1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat @@ -0,0 +1,292 @@ +%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: LitWall + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + 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} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: c6ad7b22efb776c448982ca631b16f73, type: 3} + m_Scale: {x: 5, y: 5} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: fdff8a56ae2c830478b84c6807aa0408, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + 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} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _BumpScale: 1 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _DstBlend: 0 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _Metallic: 0 + - _MinXUV: 0 + - _MinYUV: 0 + - _Mode: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 5 + - _OcclusionStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _Parallax: 0.02 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _UVSec: 0 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat.meta new file mode 100644 index 000000000..5b2b89d68 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 38bc0196d341b5b4a9998eff3a9112b9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat new file mode 100644 index 000000000..9135e846a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat @@ -0,0 +1,238 @@ +%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: MagicRing + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLUR_ON DISTORT_ON ETC1_EXTERNAL_ALPHA GLOW_ON OUTBASE8DIR_ON + OUTBASEPIXELPERF_ON OUTBASE_ON PINCH_ON RADIALGRADIENT_ON ROTATEUV_ON TWISTUV_ON + WAVEUV_ON _GRADISRADIAL_ON _OUTLINE8DIRECTIONS_ON _OUTLINEISPIXEL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 0.9 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 100 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 1 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.79 + - _DistortTexXSpeed: -1 + - _DistortTexYSpeed: -10 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 0 + - _GhostTransparency: 0.017 + - _GlitchAmount: 20 + - _GlitchSize: 4.51 + - _Glow: 33.6 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 5 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 2 + - _HsvSaturation: 2 + - _HsvShift: 360 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 250 + - _InnerOutlineThickness: 3 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: -1 + - _MotionBlurDist: 3 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 0.306 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 1 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _PinchUvAmount: 0 + - _PixelateSize: 20 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 6.28 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 71.6 + - _ShineLocation: 0.5 + - _ShineRotate: 1.28 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.47 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.91 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 1.95 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 0.9044944, b: 0, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.4339623, g: 0.30433717, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.7998638, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat.meta new file mode 100644 index 000000000..e047657e9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1c2c3a51f881cb443906a57116cf56fe +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat new file mode 100644 index 000000000..e57919439 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat @@ -0,0 +1,188 @@ +%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: Outline1 + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA OUTBASE8DIR_ON OUTBASE_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.025 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat.meta new file mode 100644 index 000000000..8d7ce13ea --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2fff2435ee99439438c463e2ce768283 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat new file mode 100644 index 000000000..488ea8d81 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat @@ -0,0 +1,189 @@ +%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: Shield + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: BLURISHD_ON ETC1_EXTERNAL_ALPHA FADE_ON FLICKER_ON GLOWTEX_ON + GLOW_ON PIXELATE_ON TEXTURESCROLL_ON WAVEUV_ON _BLURHD_ON _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: dbaa905cec0d2b944b5d1ebdbc3ceb1e, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 81687001a52d8024fb3706ba7619ad4b, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 2f5c9cbfde2d0384bb53189b0d0f06d8, type: 3} + m_Scale: {x: 1.5, y: 1.5} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 0.332 + - _AlphaCutoffValue: 0.25 + - _BillboardY: 0 + - _BlurHD: 1 + - _BlurIntensity: 13.7 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 5.7 + - _FadeBurnTransition: 0.095 + - _FadeBurnWidth: 0 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0.888 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3.4 + - _Glow: 10 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 35.7 + - _HologramStripesFill: 0.27 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.014 + - _PinchUvAmount: 0.35 + - _PixelateSize: 66 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 0.24 + - _TextureScrollYSpeed: 0.31 + - _TwistUvAmount: 0.46 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 15 + - _WaveSpeed: 24.7 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 0, g: 0.9805136, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 0, g: 0.98090506, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 1, b: 0.9378109, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat.meta new file mode 100644 index 000000000..1db9ffe31 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4396a2d1265c9414e810fdf77d8238b5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat new file mode 100644 index 000000000..bbb61d376 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat @@ -0,0 +1,209 @@ +%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: ShieldSoldier + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA GLOWTEX_ON HSV_ON OUTBASE8DIR_ON OUTBASE_ON + _GLOWTEXUSED_ON _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 20 + - _GlitchSize: 1 + - _Glow: 6.9 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 2 + - _HsvShift: 163 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.011 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0, g: 0.23854972, b: 0.2924528, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.33333334, b: 0.6666667, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat.meta new file mode 100644 index 000000000..fe93ba16f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8a80b25e622f6c84aac445df7e206085 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat new file mode 100644 index 000000000..1a6e5447a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat @@ -0,0 +1,85 @@ +%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: SnowFlake + m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaTex: + 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} + - _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} + - _MainTex: + m_Texture: {fileID: 2800000, guid: ab4465ab72ca5544da8e8dd1110b6973, type: 3} + 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} + - _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} + m_Floats: + - PixelSnap: 0 + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnableExternalAlpha: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Flip: {r: 1, g: 1, b: 1, a: 1} + - _RendererColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat.meta new file mode 100644 index 000000000..62bdefaa1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: aae53a69b285d6f4aad0e6953245bc7d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat new file mode 100644 index 000000000..7e0fe78f0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat @@ -0,0 +1,85 @@ +%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: Sparks + m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaTex: + 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} + - _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} + - _MainTex: + m_Texture: {fileID: 2800000, guid: b382c41f6a534374390fe6d5e6e82ca8, type: 3} + 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} + - _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} + m_Floats: + - PixelSnap: 0 + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnableExternalAlpha: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Flip: {r: 1, g: 1, b: 1, a: 1} + - _RendererColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat.meta new file mode 100644 index 000000000..90e37b5ad --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e2fd28a60d223ba4cb25e286da19b13a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles.meta new file mode 100644 index 000000000..96e83daea --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fb1e0660363295c4db411edfff6675eb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset new file mode 100644 index 000000000..853226f63 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b64fb5d9b985e220b412e9f8f93b5feede76c47604804a3ff0d3f765b2ed5d8 +size 2455 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset.meta new file mode 100644 index 000000000..6d1e77d89 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c12f806a2a3ae954ebb1771c65441e4c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessProfiles/AllIn1PostProcessing.asset + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs.meta new file mode 100644 index 000000000..628bd2fa7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1393ecda48f2f88439763bd3d4a263ac +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab new file mode 100644 index 000000000..797575772 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab @@ -0,0 +1,5005 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7935039278030221704 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7935039278030221705} + - component: {fileID: 7935039278030221707} + - component: {fileID: 7935039278030221706} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7935039278030221705 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278030221704} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7935039278937507618} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &7935039278030221707 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278030221704} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!102 &7935039278030221706 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278030221704} + m_Text: Particle System + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!1 &7935039278937507617 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7935039278937507618} + - component: {fileID: 7935039278937507619} + m_Layer: 0 + m_Name: Particle System Demo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7935039278937507618 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278937507617} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 220, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7935039279205550810} + - {fileID: 7935039278030221705} + - {fileID: 7935039279796415622} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7935039278937507619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278937507617} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &7935039279205550809 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7935039279205550810} + - component: {fileID: 7935039279205550813} + - component: {fileID: 7935039279205550812} + - component: {fileID: 7935039279205550811} + m_Layer: 0 + m_Name: MagicSmokePs + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7935039279205550810 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279205550809} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2.4465578, y: 2.4465578, z: 2.4465578} + m_Children: [] + m_Father: {fileID: 7935039278937507618} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!198 &7935039279205550813 +ParticleSystem: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279205550809} + serializedVersion: 6 + lengthInSec: 2 + simulationSpeed: 1 + stopAction: 0 + cullingMode: 0 + ringBufferMode: 0 + ringBufferLoopRange: {x: 0, y: 1} + looping: 1 + prewarm: 0 + playOnAwake: 1 + useUnscaledTime: 0 + autoRandomSeed: 1 + useRigidbodyForVelocity: 1 + startDelay: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + moveWithTransform: 0 + moveWithCustomTransform: {fileID: 0} + scalingMode: 1 + randomSeed: 0 + InitialModule: + serializedVersion: 3 + enabled: 1 + startLifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 2 + minScalar: 5 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSpeed: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 5 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startColor: + serializedVersion: 2 + minMaxState: 2 + minColor: {r: 0.40085083, g: 0.254717, b: 1, a: 1} + maxColor: {r: 0.42329824, g: 0, b: 0.754717, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + startSize: + serializedVersion: 2 + minMaxState: 3 + scalar: 5.5 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeY: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeZ: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationX: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationY: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotation: + serializedVersion: 2 + minMaxState: 3 + scalar: 6.283185 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + randomizeRotationDirection: 0 + maxNumParticles: 1000 + size3D: 0 + rotation3D: 0 + gravityModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ShapeModule: + serializedVersion: 6 + enabled: 1 + type: 10 + angle: 25 + length: 5 + boxThickness: {x: 0, y: 0, z: 0} + radiusThickness: 1 + donutRadius: 0.2 + m_Position: {x: 0, y: 0, z: 0} + m_Rotation: {x: 0, y: 0, z: 0} + m_Scale: {x: 1, y: 1, z: 1} + placementMode: 0 + m_MeshMaterialIndex: 0 + m_MeshNormalOffset: 0 + m_MeshSpawn: + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Mesh: {fileID: 0} + m_MeshRenderer: {fileID: 0} + m_SkinnedMeshRenderer: {fileID: 0} + m_Sprite: {fileID: 0} + m_SpriteRenderer: {fileID: 0} + m_UseMeshMaterialIndex: 0 + m_UseMeshColors: 1 + alignToDirection: 0 + m_Texture: {fileID: 0} + m_TextureClipChannel: 3 + m_TextureClipThreshold: 0 + m_TextureUVChannel: 0 + m_TextureColorAffectsParticles: 1 + m_TextureAlphaAffectsParticles: 1 + m_TextureBilinearFiltering: 0 + randomDirectionAmount: 0 + sphericalDirectionAmount: 0 + randomPositionAmount: 0 + radius: + value: 0.13 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + arc: + value: 360 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + EmissionModule: + enabled: 1 + serializedVersion: 4 + rateOverTime: + serializedVersion: 2 + minMaxState: 0 + scalar: 10 + minScalar: 10 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rateOverDistance: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BurstCount: 0 + m_Bursts: [] + SizeModule: + enabled: 1 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + RotationModule: + enabled: 1 + x: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 3 + scalar: 2.6179938 + minScalar: -2.6179938 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + ColorModule: + enabled: 1 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 0} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 31552 + atime2: 65535 + atime3: 65535 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 3 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + UVModule: + serializedVersion: 2 + enabled: 0 + mode: 0 + timeMode: 0 + fps: 30 + frameOverTime: + serializedVersion: 2 + minMaxState: 1 + scalar: 0.9999 + minScalar: 0.9999 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startFrame: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedRange: {x: 0, y: 1} + tilesX: 1 + tilesY: 1 + animationType: 0 + rowIndex: 0 + cycles: 1 + uvChannelMask: -1 + rowMode: 1 + sprites: + - sprite: {fileID: 0} + flipU: 0 + flipV: 0 + VelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + radial: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + InheritVelocityModule: + enabled: 0 + m_Mode: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ForceModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + randomizePerFrame: 0 + ExternalForcesModule: + serializedVersion: 2 + enabled: 0 + multiplierCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + influenceFilter: 0 + influenceMask: + serializedVersion: 2 + m_Bits: 4294967295 + influenceList: [] + ClampVelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + magnitude: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxis: 0 + inWorldSpace: 0 + multiplyDragByParticleSize: 1 + multiplyDragByParticleVelocity: 1 + dampen: 0 + drag: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + NoiseModule: + enabled: 0 + strength: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthY: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + frequency: 0.5 + damping: 1 + octaves: 1 + octaveMultiplier: 0.5 + octaveScale: 2 + quality: 2 + scrollSpeed: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remap: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapY: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapZ: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapEnabled: 0 + positionAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rotationAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + sizeAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + SizeBySpeedModule: + enabled: 0 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + range: {x: 0, y: 1} + separateAxes: 0 + RotationBySpeedModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + range: {x: 0, y: 1} + ColorBySpeedModule: + enabled: 0 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + range: {x: 0, y: 1} + CollisionModule: + enabled: 0 + serializedVersion: 3 + type: 0 + collisionMode: 0 + colliderForce: 0 + multiplyColliderForceByParticleSize: 0 + multiplyColliderForceByParticleSpeed: 0 + multiplyColliderForceByCollisionAngle: 1 + plane0: {fileID: 0} + plane1: {fileID: 0} + plane2: {fileID: 0} + plane3: {fileID: 0} + plane4: {fileID: 0} + plane5: {fileID: 0} + m_Dampen: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Bounce: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_EnergyLossOnCollision: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minKillSpeed: 0 + maxKillSpeed: 10000 + radiusScale: 1 + collidesWith: + serializedVersion: 2 + m_Bits: 4294967295 + maxCollisionShapes: 256 + quality: 0 + voxelSize: 0.5 + collisionMessages: 0 + collidesWithDynamic: 1 + interiorCollisions: 0 + TriggerModule: + enabled: 0 + collisionShape0: {fileID: 0} + collisionShape1: {fileID: 0} + collisionShape2: {fileID: 0} + collisionShape3: {fileID: 0} + collisionShape4: {fileID: 0} + collisionShape5: {fileID: 0} + inside: 1 + outside: 0 + enter: 0 + exit: 0 + radiusScale: 1 + SubModule: + serializedVersion: 2 + enabled: 0 + subEmitters: + - serializedVersion: 3 + emitter: {fileID: 0} + type: 0 + properties: 0 + emitProbability: 1 + LightsModule: + enabled: 0 + ratio: 0 + light: {fileID: 0} + randomDistribution: 1 + color: 1 + range: 1 + intensity: 1 + rangeCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + intensityCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + maxLights: 20 + TrailModule: + enabled: 0 + mode: 0 + ratio: 1 + lifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minVertexDistance: 0.2 + textureMode: 0 + ribbonCount: 1 + shadowBias: 0.5 + worldSpace: 0 + dieWithParticles: 1 + sizeAffectsWidth: 1 + sizeAffectsLifetime: 0 + inheritParticleColor: 1 + generateLightingData: 0 + splitSubEmitterRibbons: 0 + attachRibbonsToTransform: 0 + colorOverLifetime: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + widthOverTrail: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorOverTrail: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + CustomDataModule: + enabled: 0 + mode0: 0 + vectorComponentCount0: 4 + color0: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel0: Color + vector0_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_0: X + vector0_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_1: Y + vector0_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_2: Z + vector0_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_3: W + mode1: 0 + vectorComponentCount1: 4 + color1: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel1: Color + vector1_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_0: X + vector1_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_1: Y + vector1_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_2: Z + vector1_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_3: W +--- !u!199 &7935039279205550812 +ParticleSystemRenderer: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279205550809} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 0} + - {fileID: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_RenderMode: 0 + m_SortMode: 3 + m_MinParticleSize: 0 + m_MaxParticleSize: 0.5 + m_CameraVelocityScale: 0 + m_VelocityScale: 0 + m_LengthScale: 2 + m_SortingFudge: 0 + m_NormalDirection: 1 + m_ShadowBias: 0 + m_RenderAlignment: 0 + m_Pivot: {x: 0, y: 0, z: 0} + m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 + m_EnableGPUInstancing: 1 + m_ApplyActiveColorSpace: 1 + m_AllowRoll: 1 + m_VertexStreams: 00010304 + m_Mesh: {fileID: 0} + m_Mesh1: {fileID: 0} + m_Mesh2: {fileID: 0} + m_Mesh3: {fileID: 0} + m_MaskInteraction: 0 +--- !u!114 &7935039279205550811 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279205550809} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!1 &7935039279796415621 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7935039279796415622} + - component: {fileID: 7935039279796415672} + - component: {fileID: 7935039279796415623} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &7935039279796415622 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279796415621} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7935039278937507618} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &7935039279796415672 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279796415621} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!102 &7935039279796415623 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279796415621} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab.meta new file mode 100644 index 000000000..30e047444 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 161eac4f3ec2ef344ae473e275658ecf +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab new file mode 100644 index 000000000..ba7cbad03 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab @@ -0,0 +1,5267 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3864259598328230473 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259598328230474} + - component: {fileID: 3864259598328230476} + - component: {fileID: 3864259598328230475} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259598328230474 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598328230473} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 3864259599682641153} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &3864259598328230476 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598328230473} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!102 &3864259598328230475 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598328230473} + m_Text: Shield Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!1 &3864259598540621426 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259598540621427} + - component: {fileID: 3864259598540621429} + - component: {fileID: 3864259598540621428} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259598540621427 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598540621426} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 3864259599682641153} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &3864259598540621429 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598540621426} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!102 &3864259598540621428 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598540621426} + m_Text: (Sprite Mask and Particles) + m_OffsetZ: -1.5 + m_CharacterSize: 0.05 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!1 &3864259599192371921 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259599192371922} + - component: {fileID: 3864259599192371923} + m_Layer: 0 + m_Name: Shield + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259599192371922 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599192371921} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.0582, y: 0.0478, z: -0.1} + m_LocalScale: {x: 1.3402556, y: 1.4230473, z: 1} + m_Children: [] + m_Father: {fileID: 3864259599682641153} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &3864259599192371923 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599192371921} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 4396a2d1265c9414e810fdf77d8238b5, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2f5c9cbfde2d0384bb53189b0d0f06d8, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 1 + m_SpriteSortPoint: 0 +--- !u!1 &3864259599213150330 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259599213150331} + - component: {fileID: 3864259599213150333} + - component: {fileID: 3864259599213150332} + m_Layer: 0 + m_Name: ShieldSparksPS + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259599213150331 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599213150330} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.058, y: 0.038, z: -0.1} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3864259599682641153} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!198 &3864259599213150333 +ParticleSystem: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599213150330} + serializedVersion: 6 + lengthInSec: 1 + simulationSpeed: 1 + stopAction: 0 + cullingMode: 0 + ringBufferMode: 0 + ringBufferLoopRange: {x: 0, y: 1} + looping: 1 + prewarm: 0 + playOnAwake: 1 + useUnscaledTime: 0 + autoRandomSeed: 1 + useRigidbodyForVelocity: 1 + startDelay: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + moveWithTransform: 1 + moveWithCustomTransform: {fileID: 0} + scalingMode: 1 + randomSeed: 0 + InitialModule: + serializedVersion: 3 + enabled: 1 + startLifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.75 + minScalar: 5 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSpeed: + serializedVersion: 2 + minMaxState: 3 + scalar: 0.2 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startColor: + serializedVersion: 2 + minMaxState: 2 + minColor: {r: 0.009433985, g: 1, b: 0.9403363, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + startSize: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 0.1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeY: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeZ: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationX: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationY: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotation: + serializedVersion: 2 + minMaxState: 3 + scalar: 6.283185 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + randomizeRotationDirection: 0 + maxNumParticles: 1000 + size3D: 0 + rotation3D: 0 + gravityModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ShapeModule: + serializedVersion: 6 + enabled: 1 + type: 12 + angle: 25 + length: 5 + boxThickness: {x: 0, y: 0, z: 0} + radiusThickness: 1 + donutRadius: 0.2 + m_Position: {x: 0, y: 0, z: 0} + m_Rotation: {x: 0, y: 0, z: 0} + m_Scale: {x: 1, y: 1, z: 1} + placementMode: 0 + m_MeshMaterialIndex: 0 + m_MeshNormalOffset: 0 + m_MeshSpawn: + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Mesh: {fileID: 0} + m_MeshRenderer: {fileID: 0} + m_SkinnedMeshRenderer: {fileID: 0} + m_Sprite: {fileID: 0} + m_SpriteRenderer: {fileID: 0} + m_UseMeshMaterialIndex: 0 + m_UseMeshColors: 1 + alignToDirection: 0 + m_Texture: {fileID: 0} + m_TextureClipChannel: 3 + m_TextureClipThreshold: 0 + m_TextureUVChannel: 0 + m_TextureColorAffectsParticles: 1 + m_TextureAlphaAffectsParticles: 1 + m_TextureBilinearFiltering: 0 + randomDirectionAmount: 0 + sphericalDirectionAmount: 0 + randomPositionAmount: 0 + radius: + value: 1.23 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + arc: + value: 360 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + EmissionModule: + enabled: 1 + serializedVersion: 4 + rateOverTime: + serializedVersion: 2 + minMaxState: 0 + scalar: 30 + minScalar: 10 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rateOverDistance: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BurstCount: 1 + m_Bursts: + - serializedVersion: 2 + time: 0 + countCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 30 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + cycleCount: 1 + repeatInterval: 0.01 + probability: 1 + SizeModule: + enabled: 1 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 15.478566 + outSlope: 15.478566 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.061415076 + value: 0.9506173 + inSlope: 0.28985757 + outSlope: 0.28985757 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.24300326 + - serializedVersion: 3 + time: 0.6683 + value: 0.8456783 + inSlope: -1.3612208 + outSlope: -1.3612208 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: -2.5495274 + outSlope: -2.5495274 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + RotationModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + ColorModule: + enabled: 1 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 23708 + atime2: 65535 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 3 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + UVModule: + serializedVersion: 2 + enabled: 0 + mode: 0 + timeMode: 0 + fps: 30 + frameOverTime: + serializedVersion: 2 + minMaxState: 1 + scalar: 0.9999 + minScalar: 0.9999 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startFrame: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedRange: {x: 0, y: 1} + tilesX: 1 + tilesY: 1 + animationType: 0 + rowIndex: 0 + cycles: 1 + uvChannelMask: -1 + rowMode: 1 + sprites: + - sprite: {fileID: 0} + flipU: 0 + flipV: 0 + VelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + radial: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + InheritVelocityModule: + enabled: 0 + m_Mode: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ForceModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + randomizePerFrame: 0 + ExternalForcesModule: + serializedVersion: 2 + enabled: 0 + multiplierCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + influenceFilter: 0 + influenceMask: + serializedVersion: 2 + m_Bits: 4294967295 + influenceList: [] + ClampVelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + magnitude: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxis: 0 + inWorldSpace: 0 + multiplyDragByParticleSize: 1 + multiplyDragByParticleVelocity: 1 + dampen: 0 + drag: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + NoiseModule: + enabled: 0 + strength: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthY: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + frequency: 0.5 + damping: 1 + octaves: 1 + octaveMultiplier: 0.5 + octaveScale: 2 + quality: 2 + scrollSpeed: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remap: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapY: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapZ: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapEnabled: 0 + positionAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rotationAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + sizeAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + SizeBySpeedModule: + enabled: 0 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + range: {x: 0, y: 1} + separateAxes: 0 + RotationBySpeedModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + range: {x: 0, y: 1} + ColorBySpeedModule: + enabled: 0 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + range: {x: 0, y: 1} + CollisionModule: + enabled: 0 + serializedVersion: 3 + type: 0 + collisionMode: 0 + colliderForce: 0 + multiplyColliderForceByParticleSize: 0 + multiplyColliderForceByParticleSpeed: 0 + multiplyColliderForceByCollisionAngle: 1 + plane0: {fileID: 0} + plane1: {fileID: 0} + plane2: {fileID: 0} + plane3: {fileID: 0} + plane4: {fileID: 0} + plane5: {fileID: 0} + m_Dampen: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Bounce: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_EnergyLossOnCollision: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minKillSpeed: 0 + maxKillSpeed: 10000 + radiusScale: 1 + collidesWith: + serializedVersion: 2 + m_Bits: 4294967295 + maxCollisionShapes: 256 + quality: 0 + voxelSize: 0.5 + collisionMessages: 0 + collidesWithDynamic: 1 + interiorCollisions: 0 + TriggerModule: + enabled: 0 + collisionShape0: {fileID: 0} + collisionShape1: {fileID: 0} + collisionShape2: {fileID: 0} + collisionShape3: {fileID: 0} + collisionShape4: {fileID: 0} + collisionShape5: {fileID: 0} + inside: 1 + outside: 0 + enter: 0 + exit: 0 + radiusScale: 1 + SubModule: + serializedVersion: 2 + enabled: 0 + subEmitters: + - serializedVersion: 3 + emitter: {fileID: 0} + type: 0 + properties: 0 + emitProbability: 1 + LightsModule: + enabled: 0 + ratio: 0 + light: {fileID: 0} + randomDistribution: 1 + color: 1 + range: 1 + intensity: 1 + rangeCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + intensityCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + maxLights: 20 + TrailModule: + enabled: 0 + mode: 0 + ratio: 1 + lifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minVertexDistance: 0.2 + textureMode: 0 + ribbonCount: 1 + shadowBias: 0.5 + worldSpace: 0 + dieWithParticles: 1 + sizeAffectsWidth: 1 + sizeAffectsLifetime: 0 + inheritParticleColor: 1 + generateLightingData: 0 + splitSubEmitterRibbons: 0 + attachRibbonsToTransform: 0 + colorOverLifetime: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + widthOverTrail: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorOverTrail: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + CustomDataModule: + enabled: 0 + mode0: 0 + vectorComponentCount0: 4 + color0: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel0: Color + vector0_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_0: X + vector0_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_1: Y + vector0_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_2: Z + vector0_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_3: W + mode1: 0 + vectorComponentCount1: 4 + color1: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel1: Color + vector1_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_0: X + vector1_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_1: Y + vector1_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_2: Z + vector1_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_3: W +--- !u!199 &3864259599213150332 +ParticleSystemRenderer: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599213150330} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: e2fd28a60d223ba4cb25e286da19b13a, type: 2} + - {fileID: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_RenderMode: 0 + m_SortMode: 0 + m_MinParticleSize: 0 + m_MaxParticleSize: 0.5 + m_CameraVelocityScale: 0 + m_VelocityScale: 0 + m_LengthScale: 2 + m_SortingFudge: 0 + m_NormalDirection: 1 + m_ShadowBias: 0 + m_RenderAlignment: 0 + m_Pivot: {x: 0, y: 0, z: 0} + m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 + m_EnableGPUInstancing: 1 + m_ApplyActiveColorSpace: 1 + m_AllowRoll: 1 + m_VertexStreams: 00010304 + m_Mesh: {fileID: 0} + m_Mesh1: {fileID: 0} + m_Mesh2: {fileID: 0} + m_Mesh3: {fileID: 0} + m_MaskInteraction: 0 +--- !u!1 &3864259599682641152 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259599682641153} + - component: {fileID: 3864259599682641158} + - component: {fileID: 3864259599682641157} + - component: {fileID: 3864259599682641155} + - component: {fileID: 3864259599682641154} + m_Layer: 0 + m_Name: Shield Soldier Demo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259599682641153 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 360, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 3864259599192371922} + - {fileID: 3864259599213150331} + - {fileID: 3864259598328230474} + - {fileID: 3864259598540621427} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &3864259599682641158 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 8a80b25e622f6c84aac445df7e206085, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &3864259599682641157 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!331 &3864259599682641155 +SpriteMask: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_MaskAlphaCutoff: 0.2 + m_FrontSortingLayerID: 0 + m_BackSortingLayerID: 0 + m_FrontSortingLayer: 0 + m_BackSortingLayer: 0 + m_FrontSortingOrder: 0 + m_BackSortingOrder: 0 + m_IsCustomRangeActive: 0 + m_SpriteSortPoint: 0 +--- !u!95 &3864259599682641154 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 48122208e82681f45a0f7dda84aa301f, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab.meta new file mode 100644 index 000000000..5d6306a92 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 11bf72cfca6ba93459ddeacea51fd0bd +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts.meta new file mode 100644 index 000000000..e9a26c4b7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d00a14e1119cac04092102f8e78ad652 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs new file mode 100644 index 000000000..6baacdf34 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs @@ -0,0 +1,86 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace AllIn1SpriteShader +{ + public class All1ShaderDemoController : MonoBehaviour + { + [SerializeField] private DemoCircleExpositor[] expositors = null; + [SerializeField] private Text expositorsTitle = null, expositorsTitleOutline = null; + public float expositorDistance; + + private int currExpositor; + + [SerializeField] private GameObject background = null; + private Material backgroundMat; + [SerializeField] private float colorLerpSpeed = 0; + private Color[] targetColors; + private Color[] currentColors; + + void Start() + { + currExpositor = 0; + SetExpositorText(); + + for (int i = 0; i < expositors.Length; i++) expositors[i].transform.position = new Vector3(0, expositorDistance * i, 0); + + backgroundMat = background.GetComponent().material; + targetColors = new Color[4]; + targetColors[0] = backgroundMat.GetColor("_GradTopLeftCol"); + targetColors[1] = backgroundMat.GetColor("_GradTopRightCol"); + targetColors[2] = backgroundMat.GetColor("_GradBotLeftCol"); + targetColors[3] = backgroundMat.GetColor("_GradBotRightCol"); + currentColors = targetColors.Clone() as Color[]; + } + + void Update() + { + GetInput(); + + currentColors[0] = Color.Lerp(currentColors[0], targetColors[(0 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime); + currentColors[1] = Color.Lerp(currentColors[1], targetColors[(1 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime); + currentColors[2] = Color.Lerp(currentColors[2], targetColors[(2 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime); + currentColors[3] = Color.Lerp(currentColors[3], targetColors[(3 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime); + backgroundMat.SetColor("_GradTopLeftCol", currentColors[0]); + backgroundMat.SetColor("_GradTopRightCol", currentColors[1]); + backgroundMat.SetColor("_GradBotLeftCol", currentColors[2]); + backgroundMat.SetColor("_GradBotRightCol", currentColors[3]); + } + + private void GetInput() + { + if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A)) + { + expositors[currExpositor].ChangeTarget(-1); + } + else if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D)) + { + expositors[currExpositor].ChangeTarget(1); + } + else if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W)) + { + ChangeExpositor(-1); + } + else if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S)) + { + ChangeExpositor(1); + } + } + + private void ChangeExpositor(int offset) + { + currExpositor += offset; + if (currExpositor > expositors.Length - 1) currExpositor = 0; + else if (currExpositor < 0) currExpositor = expositors.Length - 1; + SetExpositorText(); + } + + private void SetExpositorText() + { + expositorsTitle.text = expositors[currExpositor].name; + expositorsTitleOutline.text = expositors[currExpositor].name; + } + + public int GetCurrExpositor() { return currExpositor; } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs.meta new file mode 100644 index 000000000..c7d4fb9b1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: b549ed925b49d274c876184f60faabdf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs new file mode 100644 index 000000000..61138c119 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs @@ -0,0 +1,57 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace AllIn1SpriteShader +{ + public class All1TextureOffsetOverTime : MonoBehaviour + { + [SerializeField] private string texturePropertyName = "_MainTex"; + [SerializeField] private Vector2 offsetSpeed = Vector2.zero; + + [SerializeField, Header("If missing will search object Sprite Renderer or UI Image")] + private Material mat; + + private int textureShaderId; + private Vector2 currOffset = Vector2.zero; + + private void Start() + { + //Get material if missing + if (mat == null) + { + SpriteRenderer sr = GetComponent(); + if (sr != null) mat = sr.material; + else + { + Image i = GetComponent(); + if (i != null) mat = i.material; + } + } + + //Show error message if material or textureName property error + //Otherwise cache shader property ID + if (mat == null) DestroyComponentAndLogError(gameObject.name + " has no valid Material, deleting All1TextureOffsetOverTIme component"); + else + { + if (mat.HasProperty(texturePropertyName)) textureShaderId = Shader.PropertyToID(texturePropertyName); + else DestroyComponentAndLogError(gameObject.name + "'s Material doesn't have a " + texturePropertyName + " property"); + } + } + + public void Update() + { + //Update currOffset and update shader property + currOffset.x += offsetSpeed.x * Time.deltaTime; + currOffset.y += offsetSpeed.y * Time.deltaTime; + mat.SetTextureOffset(textureShaderId, currOffset); + } + + private void DestroyComponentAndLogError(string logError) + { + Debug.LogError(logError); + Destroy(this); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs.meta new file mode 100644 index 000000000..0f89ce4ce --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: f3804424ee2f162418d9294faf7ba055 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs new file mode 100644 index 000000000..a231d85d1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace AllIn1SpriteShader.Demo.Scripts +{ + public class AllIn1AutoRotate : MonoBehaviour + { + [SerializeField] private float rotationSpeed = 30f; + [SerializeField] private Vector3 rotationAxis = Vector3.up; + [SerializeField] private bool useLocalRotation; + + private void Update() + { + transform.Rotate(rotationAxis * (rotationSpeed * Time.deltaTime), useLocalRotation ? Space.Self : Space.World); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs.meta new file mode 100644 index 000000000..2fc5f4ffd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: f2560c72fbbcfe44195e240286d1d4e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs new file mode 100644 index 000000000..d98f8e7f6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs @@ -0,0 +1,62 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace AllIn1SpriteShader +{ + public class AllIn1ScrollProperty : MonoBehaviour + { + [SerializeField] private string numericPropertyName = "_RotateUvAmount"; + [SerializeField] private float scrollSpeed = 0f; + + [Space, SerializeField] private bool applyModulo = false; + [SerializeField] private float modulo = 1f; + + [Space, SerializeField, Header("If missing will search object Sprite Renderer or UI Image")] + private Material mat; + + private int propertyShaderID; + private float currValue; + + public void Start() + { + //Get material if missing + if (mat == null) + { + SpriteRenderer sr = GetComponent(); + if (sr != null) mat = sr.material; + else + { + Image i = GetComponent(); + if (i != null) mat = i.material; + } + } + + //Show error message if material or numericPropertyName property error + //Otherwise cache shader property ID + if (mat == null) DestroyComponentAndLogError(gameObject.name + " has no valid Material, deleting All1TextureOffsetOverTIme component"); + else + { + if (mat.HasProperty(numericPropertyName)) propertyShaderID = Shader.PropertyToID(numericPropertyName); + else DestroyComponentAndLogError(gameObject.name + "'s Material doesn't have a " + numericPropertyName + " property"); + + currValue = mat.GetFloat(propertyShaderID); + } + } + + private void Update() + { + //Update currOffset and update shader property + currValue += scrollSpeed * Time.deltaTime; + if (applyModulo) currValue %= modulo; + mat.SetFloat(propertyShaderID, currValue); + } + + private void DestroyComponentAndLogError(string logError) + { + Debug.LogError(logError); + Destroy(this); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs.meta new file mode 100644 index 000000000..d8b110c43 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 384dba07353e1f242b467b6857a1e3d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs new file mode 100644 index 000000000..165b5f64f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class Demo2AutoScroll : MonoBehaviour + { + private Transform[] children; + public float totalTime; + public GameObject sceneDescription = null; + + void Start() + { + sceneDescription.SetActive(false); + Camera.main.fieldOfView = 60f; + children = GetComponentsInChildren(); + for (int i = 0; i < children.Length; i++) + { + if (children[i].gameObject != gameObject) + { + children[i].gameObject.SetActive(false); + children[i].localPosition = Vector3.zero; + } + } + + totalTime = totalTime / (float)children.Length; + + StartCoroutine(ScrollElements()); + } + + IEnumerator ScrollElements() + { + int i = 0; + while (true) + { + if (children[i].gameObject == gameObject) + { + i = (i + 1) % children.Length; + continue; + } + children[i].gameObject.SetActive(true); + yield return new WaitForSeconds(totalTime); + children[i].gameObject.SetActive(false); + i = (i + 1) % children.Length; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs.meta new file mode 100644 index 000000000..96fe7739e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: cc188be2d64e8d041aed6f375d92c463 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs new file mode 100644 index 000000000..35fe11439 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs @@ -0,0 +1,36 @@ +using System.Collections; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoCamera : MonoBehaviour + { + [SerializeField] private Transform targetedItem = null; + [SerializeField] private All1ShaderDemoController demoController = null; + [SerializeField] private float speed = 0; + private Vector3 offset; + private Vector3 target; + private bool canUpdate = false; + + void Awake() + { + offset = transform.position - targetedItem.position; + StartCoroutine(SetCamAfterStart()); + } + + private void Update() + { + if (!canUpdate) return; + target.y = demoController.GetCurrExpositor() * demoController.expositorDistance; + transform.position = Vector3.Lerp(transform.position, target, speed * Time.deltaTime); + } + + IEnumerator SetCamAfterStart() + { + yield return null; + transform.position = targetedItem.position + offset; + target = transform.position; + canUpdate = true; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs.meta new file mode 100644 index 000000000..5877d8ca8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: fcb2e887baa071545bad04c7b0e87cce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs new file mode 100644 index 000000000..3fa399f68 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs @@ -0,0 +1,54 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoCircleExpositor : MonoBehaviour + { + [SerializeField] private float radius = 40f; + [SerializeField] private float rotateSpeed = 10f; + + private float zOffset = 0f; + private Transform[] items; + private int count = 0; + private int currentTarget = 0; + private float offsetRotation, iniY; + private Quaternion dummyRotation; + + void Start() + { + dummyRotation = transform.rotation; + iniY = transform.position.y; + + items = new Transform[transform.childCount]; + foreach (Transform child in transform) + { + items[count] = child; + count++; + } + + offsetRotation = 360.0f / count; + for (int i = 0; i < count; i++) + { + float angle = i * Mathf.PI * 2f / count; + Vector3 newPos = new Vector3(Mathf.Sin(angle) * radius, iniY, -Mathf.Cos(angle) * radius); + items[i].position = newPos; + } + + zOffset = radius - 40f; + transform.position = new Vector3(transform.position.x, transform.position.y, zOffset); + } + + private void Update() + { + transform.rotation = Quaternion.Slerp(transform.rotation, dummyRotation, rotateSpeed * Time.deltaTime); + } + + public void ChangeTarget(int offset) + { + currentTarget += offset; + if (currentTarget > items.Length - 1) currentTarget = 0; + else if (currentTarget < 0) currentTarget = items.Length - 1; + dummyRotation *= Quaternion.Euler(Vector3.up * (offset * offsetRotation)); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs.meta new file mode 100644 index 000000000..fbac01d8a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 6972382efdee4c642812251660f0c4bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs new file mode 100644 index 000000000..95a88bfee --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoItem : MonoBehaviour + { + static readonly Vector3 lookAtZ = new Vector3(0, 0, 1); + + void Update() + { + transform.LookAt(transform.position + lookAtZ); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs.meta new file mode 100644 index 000000000..1bb1f0b81 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 98b644315d7a92842b89e04f55c48e02 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs new file mode 100644 index 000000000..afa8d7b2a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoRandomColorSwap : MonoBehaviour + { + private Material mat; + private readonly int colorSwapRed = Shader.PropertyToID("_ColorSwapRed"); + private readonly int colorSwapGreen = Shader.PropertyToID("_ColorSwapGreen"); + private readonly int colorSwapBlue = Shader.PropertyToID("_ColorSwapBlue"); + + void Start() + { + SpriteRenderer sr = GetComponent(); + if (sr != null) + { + mat = GetComponent().material; + if (mat != null) InvokeRepeating(nameof(NewColor), 0.0f, 0.6f); + else + { + Debug.LogError("No material found"); + Destroy(this); + } + } + } + + private void NewColor() + { + mat.SetColor(colorSwapRed, GenerateColor()); + mat.SetColor(colorSwapGreen, GenerateColor()); + mat.SetColor(colorSwapBlue, GenerateColor()); + } + + private Color GenerateColor() + { + return new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1f); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs.meta new file mode 100644 index 000000000..1c9a2a33f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 4ef3964599ee48c4ea5a4ecf012ed949 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs new file mode 100644 index 000000000..b26becf8f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoRepositionExpositor : MonoBehaviour + { + [SerializeField] private float paddingX = 10f; + + [ContextMenu("RepositionExpositor")] + private void RepositionExpositor() + { + int i = 0; + Vector3 tempLocalPos = Vector3.zero; + foreach (Transform child in transform) + { + tempLocalPos.x = i * paddingX; + child.localPosition = tempLocalPos; + i++; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs.meta new file mode 100644 index 000000000..fc6f53106 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 681095680e77fad40a6dd907b8ba358b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures.meta new file mode 100644 index 000000000..690e5f765 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2079251647b8b824abecc812d174a9f3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png new file mode 100644 index 000000000..dae9608e3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83a209658c4e7c1664901186c7f780f6baf2840795813f1f859bb3b4d0f857e1 +size 74502 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png.meta new file mode 100644 index 000000000..23b98d98b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png.meta @@ -0,0 +1,204 @@ +fileFormatVersion: 2 +guid: 07103c52b3aaeca4da8a83361edd059f +TextureImporter: + internalIDToNameTable: + - first: + 213: 21300000 + second: Boy + - first: + 213: 21300002 + second: Girl + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + cookieLightType: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: Boy + rect: + serializedVersion: 2 + x: 3 + y: 495 + width: 566 + height: 485 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 6b3b5448e2e55624aa5325fede49615b + internalID: 21300000 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Girl + rect: + serializedVersion: 2 + x: 526 + y: 34 + width: 486 + height: 484 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: d759c9ac7a1ec634cbff17145cdcce9e + internalID: 21300002 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 396e3acf790e9eb478ef7901a27a3a08 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + Boy: 21300000 + Girl: 21300002 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png new file mode 100644 index 000000000..34f9d52d5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82e8394a3122deb48992b7c6df384cba4b04bc389b776f3d26100c390815e091 +size 78 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png.meta new file mode 100644 index 000000000..58ce15937 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png.meta @@ -0,0 +1,353 @@ +fileFormatVersion: 2 +guid: 4b40fc0f65c85f14fbc9c7c5f40ca686 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + 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: 0 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 3 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 4 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 4 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: + - - {x: 0, y: 2} + - {x: -0.09813535, y: 1.9975909} + - {x: -0.19603428, y: 1.9903694} + - {x: -0.29346094, y: 1.978353} + - {x: -0.39018065, y: 1.9615705} + - {x: -0.4859604, y: 1.9400625} + - {x: -0.5805693, y: 1.9138807} + - {x: -0.67377967, y: 1.8830881} + - {x: -0.76536685, y: 1.8477591} + - {x: -0.8551101, y: 1.8079786} + - {x: -0.9427934, y: 1.7638426} + - {x: -1.0282055, y: 1.7154572} + - {x: -1.1111405, y: 1.6629392} + - {x: -1.1913986, y: 1.606415} + - {x: -1.2687867, y: 1.5460209} + - {x: -1.343118, y: 1.4819021} + - {x: -1.4142137, y: 1.4142134} + - {x: -1.4819024, y: 1.3431177} + - {x: -1.5460211, y: 1.2687864} + - {x: -1.6064153, y: 1.1913984} + - {x: -1.6629394, y: 1.1111403} + - {x: -1.7154574, y: 1.0282052} + - {x: -1.7638427, y: 0.94279313} + - {x: -1.8079787, y: 0.8551098} + - {x: -1.8477592, y: 0.76536644} + - {x: -1.8830884, y: 0.6737792} + - {x: -1.9138808, y: 0.5805688} + - {x: -1.9400626, y: 0.48595977} + - {x: -1.9615707, y: 0.39018002} + - {x: -1.9783531, y: 0.29346028} + - {x: -1.9903696, y: 0.19603357} + - {x: -1.9975909, y: 0.098134585} + - {x: -2, y: -0.0000008026785} + - {x: -1.9975909, y: -0.09813619} + - {x: -1.9903693, y: -0.19603516} + - {x: -1.9783529, y: -0.29346186} + - {x: -1.9615704, y: -0.3901816} + - {x: -1.9400623, y: -0.48596132} + - {x: -1.9138803, y: -0.58057034} + - {x: -1.8830878, y: -0.67378074} + - {x: -1.8477587, y: -0.7653679} + - {x: -1.8079782, y: -0.855111} + - {x: -1.7638422, y: -0.9427941} + - {x: -1.715457, y: -1.028206} + - {x: -1.6629391, y: -1.1111407} + - {x: -1.606415, y: -1.1913987} + - {x: -1.546021, y: -1.2687865} + - {x: -1.4819025, y: -1.3431177} + - {x: -1.4142139, y: -1.4142132} + - {x: -1.3431184, y: -1.4819018} + - {x: -1.2687873, y: -1.5460204} + - {x: -1.1913995, y: -1.6064144} + - {x: -1.1111416, y: -1.6629385} + - {x: -1.0282067, y: -1.7154565} + - {x: -0.9427949, y: -1.7638417} + - {x: -0.85511184, y: -1.8079778} + - {x: -0.76536876, y: -1.8477583} + - {x: -0.6737818, y: -1.8830874} + - {x: -0.5805717, y: -1.91388} + - {x: -0.48596293, y: -1.9400618} + - {x: -0.39018345, y: -1.96157} + - {x: -0.29346398, y: -1.9783525} + - {x: -0.1960375, y: -1.9903691} + - {x: -0.09813879, y: -1.9975908} + - {x: -0.0000036398517, y: -2} + - {x: 0.098131515, y: -1.9975911} + - {x: 0.19603026, y: -1.9903698} + - {x: 0.29345676, y: -1.9783536} + - {x: 0.3901763, y: -1.9615715} + - {x: 0.48595586, y: -1.9400636} + - {x: 0.58056474, y: -1.913882} + - {x: 0.67377496, y: -1.8830898} + - {x: 0.765362, y: -1.847761} + - {x: 0.8551053, y: -1.8079809} + - {x: 0.94278854, y: -1.7638452} + - {x: 1.0282005, y: -1.7154602} + - {x: 1.1111355, y: -1.6629425} + - {x: 1.1913936, y: -1.6064187} + - {x: 1.2687817, y: -1.5460249} + - {x: 1.3431131, y: -1.4819067} + - {x: 1.4142088, y: -1.4142184} + - {x: 1.4818976, y: -1.3431231} + - {x: 1.5460167, y: -1.2687918} + - {x: 1.6064112, y: -1.1914037} + - {x: 1.6629357, y: -1.1111456} + - {x: 1.7154542, y: -1.0282105} + - {x: 1.7638398, y: -0.94279844} + - {x: 1.8079762, y: -0.855115} + - {x: 1.8477571, y: -0.76537156} + - {x: 1.8830866, y: -0.6737842} + - {x: 1.9138794, y: -0.5805737} + - {x: 1.9400615, y: -0.48596448} + - {x: 1.9615698, y: -0.39018452} + - {x: 1.9783524, y: -0.29346457} + - {x: 1.9903691, y: -0.19603767} + - {x: 1.9975908, y: -0.09813846} + - {x: 2, y: -0.0000028371733} + - {x: 1.997591, y: 0.0981328} + - {x: 1.9903697, y: 0.19603202} + - {x: 1.9783533, y: 0.29345897} + - {x: 1.9615709, y: 0.39017895} + - {x: 1.9400629, y: 0.48595896} + - {x: 1.9138811, y: 0.58056825} + - {x: 1.8830885, y: 0.6737789} + - {x: 1.8477592, y: 0.7653663} + - {x: 1.8079787, y: 0.8551099} + - {x: 1.7638426, y: 0.9427934} + - {x: 1.7154571, y: 1.0282056} + - {x: 1.662939, y: 1.1111408} + - {x: 1.6064146, y: 1.1913992} + - {x: 1.5460203, y: 1.2687874} + - {x: 1.4819014, y: 1.3431189} + - {x: 1.4142125, y: 1.4142147} + - {x: 1.3431165, y: 1.4819036} + - {x: 1.2687849, y: 1.5460223} + - {x: 1.1913966, y: 1.6064166} + - {x: 1.1111382, y: 1.6629407} + - {x: 1.0282029, y: 1.7154588} + - {x: 0.94279057, y: 1.7638441} + - {x: 0.85510695, y: 1.8079801} + - {x: 0.76536334, y: 1.8477606} + - {x: 0.67377585, y: 1.8830895} + - {x: 0.58056515, y: 1.9138819} + - {x: 0.48595583, y: 1.9400636} + - {x: 0.3901758, y: 1.9615716} + - {x: 0.29345578, y: 1.9783537} + - {x: 0.1960288, y: 1.99037} + - {x: 0.09812956, y: 1.9975911} + physicsShape: + - - {x: 0, y: 2} + - {x: -0.09813535, y: 1.9975909} + - {x: -0.19603428, y: 1.9903694} + - {x: -0.29346094, y: 1.978353} + - {x: -0.39018065, y: 1.9615705} + - {x: -0.4859604, y: 1.9400625} + - {x: -0.5805693, y: 1.9138807} + - {x: -0.67377967, y: 1.8830881} + - {x: -0.76536685, y: 1.8477591} + - {x: -0.8551101, y: 1.8079786} + - {x: -0.9427934, y: 1.7638426} + - {x: -1.0282055, y: 1.7154572} + - {x: -1.1111405, y: 1.6629392} + - {x: -1.1913986, y: 1.606415} + - {x: -1.2687867, y: 1.5460209} + - {x: -1.343118, y: 1.4819021} + - {x: -1.4142137, y: 1.4142134} + - {x: -1.4819024, y: 1.3431177} + - {x: -1.5460211, y: 1.2687864} + - {x: -1.6064153, y: 1.1913984} + - {x: -1.6629394, y: 1.1111403} + - {x: -1.7154574, y: 1.0282052} + - {x: -1.7638427, y: 0.94279313} + - {x: -1.8079787, y: 0.8551098} + - {x: -1.8477592, y: 0.76536644} + - {x: -1.8830884, y: 0.6737792} + - {x: -1.9138808, y: 0.5805688} + - {x: -1.9400626, y: 0.48595977} + - {x: -1.9615707, y: 0.39018002} + - {x: -1.9783531, y: 0.29346028} + - {x: -1.9903696, y: 0.19603357} + - {x: -1.9975909, y: 0.098134585} + - {x: -2, y: -0.0000008026785} + - {x: -1.9975909, y: -0.09813619} + - {x: -1.9903693, y: -0.19603516} + - {x: -1.9783529, y: -0.29346186} + - {x: -1.9615704, y: -0.3901816} + - {x: -1.9400623, y: -0.48596132} + - {x: -1.9138803, y: -0.58057034} + - {x: -1.8830878, y: -0.67378074} + - {x: -1.8477587, y: -0.7653679} + - {x: -1.8079782, y: -0.855111} + - {x: -1.7638422, y: -0.9427941} + - {x: -1.715457, y: -1.028206} + - {x: -1.6629391, y: -1.1111407} + - {x: -1.606415, y: -1.1913987} + - {x: -1.546021, y: -1.2687865} + - {x: -1.4819025, y: -1.3431177} + - {x: -1.4142139, y: -1.4142132} + - {x: -1.3431184, y: -1.4819018} + - {x: -1.2687873, y: -1.5460204} + - {x: -1.1913995, y: -1.6064144} + - {x: -1.1111416, y: -1.6629385} + - {x: -1.0282067, y: -1.7154565} + - {x: -0.9427949, y: -1.7638417} + - {x: -0.85511184, y: -1.8079778} + - {x: -0.76536876, y: -1.8477583} + - {x: -0.6737818, y: -1.8830874} + - {x: -0.5805717, y: -1.91388} + - {x: -0.48596293, y: -1.9400618} + - {x: -0.39018345, y: -1.96157} + - {x: -0.29346398, y: -1.9783525} + - {x: -0.1960375, y: -1.9903691} + - {x: -0.09813879, y: -1.9975908} + - {x: -0.0000036398517, y: -2} + - {x: 0.098131515, y: -1.9975911} + - {x: 0.19603026, y: -1.9903698} + - {x: 0.29345676, y: -1.9783536} + - {x: 0.3901763, y: -1.9615715} + - {x: 0.48595586, y: -1.9400636} + - {x: 0.58056474, y: -1.913882} + - {x: 0.67377496, y: -1.8830898} + - {x: 0.765362, y: -1.847761} + - {x: 0.8551053, y: -1.8079809} + - {x: 0.94278854, y: -1.7638452} + - {x: 1.0282005, y: -1.7154602} + - {x: 1.1111355, y: -1.6629425} + - {x: 1.1913936, y: -1.6064187} + - {x: 1.2687817, y: -1.5460249} + - {x: 1.3431131, y: -1.4819067} + - {x: 1.4142088, y: -1.4142184} + - {x: 1.4818976, y: -1.3431231} + - {x: 1.5460167, y: -1.2687918} + - {x: 1.6064112, y: -1.1914037} + - {x: 1.6629357, y: -1.1111456} + - {x: 1.7154542, y: -1.0282105} + - {x: 1.7638398, y: -0.94279844} + - {x: 1.8079762, y: -0.855115} + - {x: 1.8477571, y: -0.76537156} + - {x: 1.8830866, y: -0.6737842} + - {x: 1.9138794, y: -0.5805737} + - {x: 1.9400615, y: -0.48596448} + - {x: 1.9615698, y: -0.39018452} + - {x: 1.9783524, y: -0.29346457} + - {x: 1.9903691, y: -0.19603767} + - {x: 1.9975908, y: -0.09813846} + - {x: 2, y: -0.0000028371733} + - {x: 1.997591, y: 0.0981328} + - {x: 1.9903697, y: 0.19603202} + - {x: 1.9783533, y: 0.29345897} + - {x: 1.9615709, y: 0.39017895} + - {x: 1.9400629, y: 0.48595896} + - {x: 1.9138811, y: 0.58056825} + - {x: 1.8830885, y: 0.6737789} + - {x: 1.8477592, y: 0.7653663} + - {x: 1.8079787, y: 0.8551099} + - {x: 1.7638426, y: 0.9427934} + - {x: 1.7154571, y: 1.0282056} + - {x: 1.662939, y: 1.1111408} + - {x: 1.6064146, y: 1.1913992} + - {x: 1.5460203, y: 1.2687874} + - {x: 1.4819014, y: 1.3431189} + - {x: 1.4142125, y: 1.4142147} + - {x: 1.3431165, y: 1.4819036} + - {x: 1.2687849, y: 1.5460223} + - {x: 1.1913966, y: 1.6064166} + - {x: 1.1111382, y: 1.6629407} + - {x: 1.0282029, y: 1.7154588} + - {x: 0.94279057, y: 1.7638441} + - {x: 0.85510695, y: 1.8079801} + - {x: 0.76536334, y: 1.8477606} + - {x: 0.67377585, y: 1.8830895} + - {x: 0.58056515, y: 1.9138819} + - {x: 0.48595583, y: 1.9400636} + - {x: 0.3901758, y: 1.9615716} + - {x: 0.29345578, y: 1.9783537} + - {x: 0.1960288, y: 1.99037} + - {x: 0.09812956, y: 1.9975911} + bones: [] + spriteID: 9a5d93fd276093242b4d07bd28b8611a + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png new file mode 100644 index 000000000..15bb53aa8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2241577579ed3973fe9d032214d6aa4a3c22be459c1bd7a48e37626d00c3a513 +size 555451 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png.meta new file mode 100644 index 000000000..60da12940 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 49cc75da86b2bb949b1235ad2a384f9b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 47b0447a9c1f42444a0656dca4167218 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png new file mode 100644 index 000000000..9e99ec921 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52b17e2d52e0039055e12d9cb124cbe2d060bc7cb40a1783028999e8b98c3a6e +size 52424 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png.meta new file mode 100644 index 000000000..6d9a7ffb5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 7f33f36658f399a44be84455bcd911b1 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 4ac03ff046060d047baa00b1ec42dcf2 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png new file mode 100644 index 000000000..61bb95b3c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b0c891b572ce4bd3e0ae03338c27c5af9f018751ef71b8ddbcb362ec8655c1f +size 152570 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png.meta new file mode 100644 index 000000000..777c3a76d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png.meta @@ -0,0 +1,128 @@ +fileFormatVersion: 2 +guid: 2ea3ea54c499d314f957e0a47dc11c9c +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + 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 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: af5c8d9995b9cee40bde0cdd45bcd67c + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png new file mode 100644 index 000000000..59542efe1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de227a602628f2b29a93adc732c915871f0d30ec6d74fd09760cb0d2f063b8e8 +size 1197308 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png.meta new file mode 100644 index 000000000..7c785c6a0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: c6ad7b22efb776c448982ca631b16f73 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + 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 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + 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 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png new file mode 100644 index 000000000..72a40c0bc --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09d0a7a8b9b5fbd8e3a55df44b9def4ee8f0027721bb037818571bfe9492b454 +size 333783 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png.meta new file mode 100644 index 000000000..7ad6931d2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: fdff8a56ae2c830478b84c6807aa0408 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + 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 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + 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: 1 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png new file mode 100644 index 000000000..34f9d52d5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82e8394a3122deb48992b7c6df384cba4b04bc389b776f3d26100c390815e091 +size 78 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png.meta new file mode 100644 index 000000000..581caaf24 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png.meta @@ -0,0 +1,105 @@ +fileFormatVersion: 2 +guid: fab06e0be9375cc4d823efa71629885c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + 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: 0 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 3 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 4 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 4 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: + - - {x: -2, y: -2} + - {x: -2, y: 2} + - {x: 2, y: 2} + - {x: 2, y: -2} + physicsShape: + - - {x: -2, y: -2} + - {x: -2, y: 2} + - {x: 2, y: 2} + - {x: 2, y: -2} + bones: [] + spriteID: a6651eff1c5cc3945bb789d5017c08a6 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png new file mode 100644 index 000000000..acf281e7f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef3eb77b9957e5263afddbd31bedcee0a335db9881cc85b0ab3203bcddf73c19 +size 1243970 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png.meta new file mode 100644 index 000000000..898c15ad6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: fd279c0d74378ff48b61c27ffc8873eb +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + 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 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + 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 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png new file mode 100644 index 000000000..92d4c8da3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5084de5a61b7ded140d26abf5eea0fa03c35a8375189fe16f6488a21cc9c6df +size 422471 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png.meta new file mode 100644 index 000000000..3e499bc64 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 47c3680e2892fa44b80abb6447b1a619 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + 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 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + 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: 1 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png new file mode 100644 index 000000000..d189eb1ad --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa49956aa35ebcfc0114d4c68771355906842097c3eec4067ca53d3243e6b7d9 +size 283125 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png.meta new file mode 100644 index 000000000..41946e65d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: 758ac31a9bff9ac4181f54de54a6ecb7 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 150 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 00ec50f99942acb49b4119afac5cab4c + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png new file mode 100644 index 000000000..a3e86c4f5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f471ad7a8a52024848a867c1e64afb07a644e12047412969e85652502968fe01 +size 484860 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png.meta new file mode 100644 index 000000000..22d851861 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: be304275dbf36014ca9828884588ac47 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: d8ea15f629e486e4f8c115ff7f00f1b4 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png new file mode 100644 index 000000000..2ffc4eb3f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8c1fd7967cc60ea1a675b5102bacfbd3c3bf4d29f663ab939f04f1a2649b57f +size 279661 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png.meta new file mode 100644 index 000000000..9acc8ea0a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 487cb2374bc49b848a1f4577212201cc +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: bfb7e5498e23b9d418474e1af6babf32 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png new file mode 100644 index 000000000..bedd64bc7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:829e0d9463fbc8a61b49a65d479c82513a3f7fe26ed5e9329dea2fd855e7123b +size 3241 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png.meta new file mode 100644 index 000000000..58238f33b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png.meta @@ -0,0 +1,204 @@ +fileFormatVersion: 2 +guid: adce45105552071409c959137cb5b670 +TextureImporter: + internalIDToNameTable: + - first: + 213: 21300000 + second: flag_0 + - first: + 213: 21300002 + second: flag_1 + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 50 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + cookieLightType: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: flag_0 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 63 + height: 217 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 02305410000000000800000000000000 + internalID: 21300000 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: flag_1 + rect: + serializedVersion: 2 + x: 94 + y: 103 + width: 109 + height: 88 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 22305410000000000800000000000000 + internalID: 21300002 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + flag_0: 21300000 + flag_1: 21300002 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png new file mode 100644 index 000000000..fc4440c11 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d827cd378193dfdde8666a040581ca406b52bf5d8442c6fa4bdcaf5856642bc +size 32335 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png.meta new file mode 100644 index 000000000..2424d9a1c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: bd6f48b4407043345b1a3a07df8c4d61 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: fbcc62d8a76faef47aa92538608d3b3a + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png new file mode 100644 index 000000000..ed3c205c6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9edd11a60dc0329c3d7638c4525e7f9720e66ae7cdaaf48003ef3b430194a9da +size 551919 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png.meta new file mode 100644 index 000000000..c86d8eded --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: cf7e1f6ebb800154db2b215cba9330ee +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: a7ab056890d43d6478c408756e97f7cf + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png new file mode 100644 index 000000000..aa2c71795 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1f619a07f81023562ff0acdd2a7b51d35e6f1f78ce435196ec4f1cc483286b5 +size 21189 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png.meta new file mode 100644 index 000000000..0258c2b9b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 2f5c9cbfde2d0384bb53189b0d0f06d8 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 7f8abd90ff7053b4cabb4381c9c4ebe7 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png new file mode 100644 index 000000000..86672ddff --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3807aa3ad7ae7685ebdb3978bf8531ce373f2f448ddee9758527178403015d9 +size 18433 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png.meta new file mode 100644 index 000000000..30a0c9d75 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 81687001a52d8024fb3706ba7619ad4b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 09f38e087cda7674aadf332d14971ac4 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png new file mode 100644 index 000000000..b031436b0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ce398af00a27765215ffa3ebfa778b48f9cd77038bf51125d2ddb503034b4c3 +size 5209 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png.meta new file mode 100644 index 000000000..01d2ae38f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: ab4465ab72ca5544da8e8dd1110b6973 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: e56be7ecdc13c4f4eb4bb8416c9ae7f7 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png new file mode 100644 index 000000000..e3e3a4874 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0a463364733de26a1ed7e79a6006027fce0de437dd69ed256cf7237e7cc5a7c +size 45312 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png.meta new file mode 100644 index 000000000..35134dcc4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png.meta @@ -0,0 +1,176 @@ +fileFormatVersion: 2 +guid: 519dafacd208bb64c83d5124be03b09d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 1 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + cookieLightType: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: spaceSoldier_0 + rect: + serializedVersion: 2 + x: 90 + y: 78 + width: 343 + height: 365 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 3ff258c9fcbbf944588103ed4f2d80bc + internalID: -7390147391288916661 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 7a4cf885a6f9c7248896d6d365331dbf + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + spaceSoldier_0: -7390147391288916661 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png new file mode 100644 index 000000000..48946bd46 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:addd566c470f7da2540394fc8432b6da46744b0904c36b2ea959532482b98163 +size 30186 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png.meta new file mode 100644 index 000000000..7f0039f73 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: 065da6c7b90ca904dab9cbc6b415fd19 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 481e92f540418f34584627b3c56549ce + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png new file mode 100644 index 000000000..8c2789c03 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aedec57c1778533673155e427c082c0492d7142d24e0aded4ec839c6887a6360 +size 9803 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png.meta new file mode 100644 index 000000000..db2463e1c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: 8608ef90f91271745a17f7210fe1e7db +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 4d8dce05bf843a6418e48e1088ee3234 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png new file mode 100644 index 000000000..cc5aab301 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:363fdda3abe2146411c33df4b1a9cbcd94555d0eb87918d3dcabd742065ae704 +size 34332 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png.meta new file mode 100644 index 000000000..b87816e15 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 3d311990b7c2c59478bacea537a60a53 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: f3d4f7c1ae047ba4b94a0e777a486bab + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png new file mode 100644 index 000000000..b2ffbc738 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a8a1b4b37b23a2f01ef15539542839b420ea75c18a8748baf36d4a93cfa9c80 +size 79364 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png.meta new file mode 100644 index 000000000..7fbd7514f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png.meta @@ -0,0 +1,119 @@ +fileFormatVersion: 2 +guid: 994e4deee74379d4c83bcf0f27585f73 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + 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 + - serializedVersion: 2 + buildTarget: WebGL + 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: 1483eb4f6241cec44b70c2198a1733c7 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png new file mode 100644 index 000000000..ee727258f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40688471de110b8b4230e59dfde26f395ea8fa03f6688e4b144f0d23f5578cbe +size 3221 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png.meta new file mode 100644 index 000000000..f5aa6c3ab --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 48bde3d73ebadd04783e0c4cb7276007 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 1d800d516dfd14b47a3e68d573c77319 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png new file mode 100644 index 000000000..2e5429b7b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a28998a6419346f98e515ca0de5aabf5381489f5c0953897f2e6f1dd28431c7 +size 84869 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png.meta new file mode 100644 index 000000000..d2016f702 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 51caeab4d98b55046a9013cc2da7e427 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 107ae09ce492f7745be900c7e931a59d + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png new file mode 100644 index 000000000..c2f49b952 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2657efaf1ae88b7f81b1dad62f8d1db8142d9c52b9b8a37ac8ba39fa0564f667 +size 189680 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png.meta new file mode 100644 index 000000000..e9a1d3a7a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 73d3cc63327012249b4f98eb9289311d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 8332df90c7094ac47862f6375f5366fe + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png new file mode 100644 index 000000000..febfab384 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56e21a0bc2dcebe6ad0d465cb41481540397fc2ce327d3971f2f967bc3133cc2 +size 85480 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png.meta new file mode 100644 index 000000000..d8f94faf9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: bd3249e8aae01e748aaca0c062e2c19c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 119475dc3468b4a47b838a35c5bfa22b + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf b/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf new file mode 100644 index 0000000000000000000000000000000000000000..26c564c5f1d2fab07558baba25de699878e6ae1b GIT binary patch literal 357759 zcmdqI_gj-o+b*n2Q4s+Z5Ru-cOP6k;BOo9kgd&{)3DQCb3q^YGO}g|FNPtk3-jPlk zNUxz2I(%8rv)23SKE7lB0Xsi%kUKMT&s=S;>zs4gU&|}<3G$2FW*=Q&oxLr{^n}UL z-0rrtw7?sntAiEOW1aWTKvydrTQf^5XRg})R&nLvWVf=o(| zjy8nm@{SfROxjjpLSsU6S=rl!fBzm&_Fk=$DE$~8}NkGHV8D!@0zm3HHx6#Yz ze>eJX(^oHiS!vFn<-xg4R#Ux1hP3Jk2tFxQc|Np2G|2wJ%lkjZ; zMWBN#Vg3S&4rZ=a@>Uj(mV}P4tiU#|woF12VzRPKF0Rg2W}w?1>AulTs%`HmgBb0f zQ+7NLCL^PvGa9?F_5Yq<_SOgxs8=YW9yXN~U9dv5vh-_>gMa$Niq+#=WOKjRzkG!{ zK4K#(THapr_SlORSboM9#Qi8(W74HB|C3f3{X?CtSKorI41I%l^2ZLg;g2pbk3i--V;w<keLlZ?)pGWg4hKmL_zY%l}bai=c<^0kS^xhF{1$Jd3bpOBVSV%-nROELx zZ!{5mP}=w{oBHZCIl8I6klp^cbM@%^Ziv90)~SaMWS_5)+-3SXY}fO&Ka%rOCDT&u z5*O?%Ce`kDg=Cv|Hj6za<u1h$r{(c9;%ng@^mSnjT3gD<@=i-vFYSPmVz3|+7NK1%W<%IWM3<)r@Ny6N0_M1KiUQgOw2@UG;x zJa{80^TSdx@G=~DaE38pObMP*fs3P#}DgPhc zjKar&B`*NA$a2IqK(}KpqE}VVo0}UWc{gH7z|G8H_xZxLYRSBZjuk6-!_9VO%0C6O zYa_2A6{Bvu1#y5Fjehd;fA>m%r~-J^K-P3>%Z7^hdbt%3Q#jleTf73{b7$zt=w65a zA?|p-Tqjid&%_8M;jN$iS{%(Mv(y}0Oebq-16TC;;QCISzy9d)PDtk$T?}#5sNZ-9 zU5qCyp_@sVV#rES;@H@jtGheEqHAZq3qjNsNsnfK*J8fZpF%U#&6(Puu8vR|wG@D( zI*ik2Zu~Ck*JR<-z&;M#wc!=}VOuMvUy``BwY4fYRG{)!d3kw5gCxEL%lVi}93Y77 z@KpxR;!i-e0`$&**h6phuoOsw$kK*QoBqxXAIOQao12@y{-nGlNI*tLCYYSDysXSE z%i-CmtGb2#I_$m80h+iQ^!q#>t97;mTOLICvEHxObwUM18zUeI6F{4vqoZwlJ-9hC zTSF_R=vlbc1*DLo#M!pa^8WALuTZGWYMe&fM0VdPJm(1rhzGJrNlM1{SQe>6G#VNj zwEfV_0EdSoj*QN`aO@ID)Klte{U4T@Z;_{g5XJ%-@9PNmZrod~IUi)593MZ}-;Xym zrfx4cM%-d{$UyeaJhUw{EoD3u!D6acnWH#QdR!Ck)};K+cg2{HAN+d1x2V-Q7J2rA@6Olu}w! zG8%wsmUxJw*!Jt4c#A`Cx#^QOB>l8x*po3l;q@3Oh_IKV6epB6c)ktc=2&h^qJB;3py z9#me?zeRj}F1u{DzP9G&<)sQrU0K-y`4LY9ZG5v>^2F zQ+mP@n#SSm?v+RA%$B;OXh*Otf}dZq;cZ8X6vHpz~p{#0ZsynHD*^&9MXDpsJ*i(iAr5?`E*yLlYA@tKB%k zJVxA5@Ef0tNB^ThHGYAq50x>*$37LoZKor`DnDU=co1t&v>q;i(~oUZB<4T<%TADg z*g|z1DI3y0HDk6iRi(NxXD+%BBy|<~M^EHKtrD2HpJf*CQLji0A$Gh+c_vG^aM0$T z{`K)Z2jm@PMz>!Ba+kD-eD;UiZ)?9RhB=JOuGHAsM2wXe6-oG=c@zye)$8c%cXh5w zwzR~JT$|lqUj?DTC)4T zMUjPh%RaHDOnx?}KE4?)PnK%ky*fs)XIaR`+oFt}g?9uKb!g{4yYP+QBndtYZu1@) zh3#Gc!>Cl%8eV7cEI=?LhPSw^6WDw+-&I`sFdu9kwXVTKC9oNI92-~pu zS>_R}1DZ{8>~k70kO)MdDxe9LBYii5LHjS2`(IGMMV+td+hTXxQ0i<7wzxrM%lh)0 z8E_OC1LP{5=?CO*FTZjnsgx9L2ZIDnOlub1VNQ{7 zvDVboEIQa`>l8)bl+VJ;YBGh0+x;JwQn%JKT8Y!3Ny)CI4tgOJc>M<|S3VVlT}BHG zh%skmN8e$SQ2s)z9Lr<(#|Bldv1nB$Q>GZ{hkZhp zcQdwfSZ@GEtNhm=wprJ^lZp$cyN@@Ouv&ONy1{1IVs_UICTPE~BH?rNgtkXDt3oFk zcOKBFvARCHebsn|CkG~_Fop;J>58u(vjs2I+P<;FH3jW7loPrLeu`kG?XeF);uS$# z%nP(JU&2wcZ*Euv&PF;C^&J1UKbJ%?i)s>xS{UF$td9};*W3skI|8fZe7kn=dr-gg zdD4NCF2w6~4>MA8^=jM7*g@0m`|H-;;qM3V>ns58tmLQF!jvdRvaOw0EUT%w_JCy2 z4$qPS3Yz!;TBE0CUsXdj*BS85%cjquSL-=z8RkuV{t`h5n@a}g|Bw6K|PrSTF3@gglAHYPo^_TE@oS$W6m>B6)v$$aY8 zB#dT@B?Q!$bBj-fn5_ZQyB3MCu@OB$bxDeT+&ml**d9qj%XgfcHZ})q#bht-e1+Oew5Se;uWP zhC|NT)c`yUK84X!^m^ZPYeeA48&izSMf4YSE;8WDFMJfCdyB_SkkDYSo{`i(K4jbN z5S#1}s>Byk`b6_*21hO0Yr4PNx}~{iKjg*3H*mAlT3c6v{F}t9lvvbh>+E^_;C*XE zK|#ToxyK0W0RH8VUw&pVQ}OU?0d#k*PrsVO4)t{DDT8V6&s)G0YPuf`yJl3@C^FY% zSTB9GwIFM!gYr32E;>RT$)Cy$jZg&}DzF}E>{LeN^tL+gX*j@wvc(X(-c#m7Sa{n= zs#??BZ-V+D;;axuM>&ZN0M(iy;-W8YAL6k;R$dcKCdcN~%?yToy?0eSyeZx~8P}ei z3fg(9`Q-}E>)w<5E-wm6?zW^*X>x%P%LYq{V_{wXr8W03n3_|`Bkm$Gzp0T_K2tRn zeY)RX7p=koZGsoC)!OcV1wy!q(WhLC*p8rk+s9MbC`LIGJ8|jyn2J_^f`8@&o}a3@GTK8xitp;Kyb?!O@K}3a zdZdB~(SNsWt_+n8@!plMJ@Bf@mnI|UL^4kt)2M|-d37kAh!|i81+ad*tzmpa6o$>x zKi2R3&mv#zg_jg(jA_FcEVP&Ah5bAR@b@?^(Ge^XzvN@KP0WWYn@lHdh(2#@*4EbM zL)zkKkGWl|nKRx(`5bWiytt$~3}mmWs~_ln1~UzE6c4+=Jy5fMvivbax#D*N@K zDl^O=W8y(pn%I`S>-6ao#xyz=JYNpq2V6XFIrdioAGz!`$T3fz6=@xGc^&vq=K4S5 z_BW0?I=_k+i6i9R2iunU2t*p`*V#SwO5_9DHvIt1gBX-Tfn8M1u>}7~R$51pWVVZ{ zAxb;*rS^X6p19U}KpEfvEKXIU2LvL{z$HIKi7S~*-{eByqh0N$6nqpIu6=cVJ3N0p zgljvM52yA*Y3u!X`ZqMy24kZnS-AF_*%b5U$Mkc%RQaj$5+p`wmc$S# zxHwl>Q|!g9P0ew3+Khv6p2Gv#Pex3G{`4ii1JpSJKF_nH)Dkl$ma}fj?Px7rxDO!w ztp|@ez4{Kj2mI|Z+wi3We}zK-B%{OSPSKg{$z-qirg&px<9xC9I4U44WXPQ<7Yj=>arv zEjj*hq(?ndNgu7g1fr-c{#O{^#}sdUyrG6R2ciS*>>to43l@3{^T!(oN8ga*ytuwr zH8LEs18mN?0+R9qr0rnHsq{krD)lg%_bkjGfY#`m161FlDsE@cQYW==gL}Rik<@XI zBfgWV0qlXI$6cK3z0^-1wMEAI^yjAHg+ZHAsEw%FL$MofM1@$s2Pg8`YQ30tQc*>v1p|%8?fWLC2=IBuO?j3U!9qDyT-;ca-Z`xJ2K$#BPw@{~C zkS7R7*-iSIru~3T`fT)Tit(k^-h(A?R!$YgDE;)Osl9CAm3y37jn6$9FEEy zm;oOfD%@yI>Z+A0e`;kMdV${2#k9%pnCX_CxJrf<%TFuGa$kJ6(?4sTfSW6Z+MB>G_;xxWyK{+Nd69aq?3^d)$Ml(F)*8Se=@mAmYPRXa>t^L5(bfFLz9b zIf^p``W+pqTfP}fzk78ixpU-01F=Fgf#}!(C*47^F2(}J=YdtbpQ`ptt5)v#?q1J0 zWcJ*aalS-%%3xgwhk8o09zmmq0oS~U(7WD*s*Ep$lN|xUndiF432Y-27Y^_20oZos z_JRJkMtfbIHFCLxKqY~zXcPA{&Dvp|$1@HC{O+Y3m@WEl*+xOtCp}v%=}eqvtPXm; z2hJ%~zvSkm(wAoRPGr8Tr>8#VWO>)sb@8N0NS3j4t!vkL^Y~f^-r>~3=PQTLgxddT z-tJds9bW(>{1DZH#l6EsDlh7|cHlx9@+zWxS;qLo-Qz}IO7Z(4>Mj=A-@49{o&KUI zsv~hlh3p^b=kMRs@*XLPc6$Awxu=X@Yi82ATe297PlUwfx+EEemo{0JKTvcZwaPX5 zg1Nyn(%t89{{q^R1IXZ?)AQ@VFoTn7+xX{{jgbKx(_jH!>S*=S&G-G$0Kn&c#w7 zFtKZ51p$ifk4Buk>SWai>IaZ2Lmx(fTCYGkr`XaVBrPw{xVhU6#^KuOVOGLm#GGyFihX=2lo43;WJ)`v(D)vCn%7y~c`WiW0x7ph z&fnV{qq}z(D=QBpO$OXp=`=ZENkY3WDm0V^^Gm#>&dl4>j8>9mA#ZZT9P+1}iq)T* zc9*UJU8Xus|IP+gq`6|OPbZ#jYbuXl=8YS7*0iupo;ymOe{(w5nlIQQn8>^7v$pNB z%i@{yY^NE{g$tdfd1}_aDeoV}-{1w~QZYhO8`3mVgIJle?|g?fpPrg}w0^4Ha|OH9 z@>6K}0XJknyZ8!)F>`Mo_qOE8+Wt?0{`H{;Ck$JNWyaSknX_%MTd?HFpWrIO57wx- zYbY3s(z+*{eb^iq?X(7eVomyFrv0QQnHH!~N|e6m#os<_;2_1{^>B{%<1qEC_8yC{6e(@S~uF+|xydAcep0RI?9$SwcJ|TqGyk_0R zd`I~HfOIwsimkCczJc#d`-ahWpB~~M$^Ej^VU^phWaI9VbL}`6(t&qh0O)oSkjB@5 zT@3_Rhb!t`>s-28ZS}!njg$6fcUUPut-V0pc&QhwTWebj(|8Rased`J!o;t~XOpBs zn-Z~jJT#C$*GXl5)o+ocLG`R=lLTyUs+?L9Yi&GYG!)kSR9T#Cg!FTbS+v6=Ho%Ql zz3HZY?_@aiJ_xODWJ{q$zgLJ^yJb_9YZ3Yk?Be5`HWEb-4HFO;aN*5QEux%^bb;N} z5k>EeIcj2gHf`T41tD58zM-VcF(m^R#+#o%8?U0Yi6YhYHHRIB&R z%r%{?^E8 z?8WK)cC-C`sP~<&=kx&q%c~_~r(bg_E;$~Zn^>O6rNGaH>-UT;z;LHYDX#&<$+glc zD!rDU%grS-Z5Mszm6y$hGnZyZ*>OvaaWP7=q;eO)1ueb8{w~c?1)G)Dq1Dml)mRcs zBw=GFSvcNXkkCu&DehY!$__K7W1_tgesa~N?E~`3U8M9~q#aEuj9eZ@T!@{!We5LJ zH*WD75Xj*+_Z4JM@1AaF-|J1G{{fDI?-8ZS7u?(mV^|n}Y73@iGZHwAIgzc7u`%B^ zM5|5u%4c2-WgCS2#I@XOKA8L@Y;``94WP(Izdg5J!B+%t9u55Dg)GVifKMZSmTf4t zF#DYhY#W>Y9G~N=sDCxV(bK?Y9GB?IA@P}wc% zZu6McUK?gq!@M5E*2`G@H}LC<%<%C#H*Pv^+H zi??qU?A+E3YnZ4=YyPmgXG7@}YF+V5RMt0f#oJ_~An}f!GA}M=N}`)cWk8 zg&ccfaUNpQpz(H}w6t9S+aD%E7G36GB`->PPs@7mF6iDm4XqHsGe!(CQd*6o<Ai zJE$EES8rOZ@h@C(>3nT-#$uE5MhQMwK5m8C+zC(8G^#i6wV_13Fc3AJ9asb0P<|rJ!tYqwM}E#Ld7{-ZxH-%NUqo;mU#g0e@opz z4Rb))2R~}<5wa=PlWk&)Y2w`@nv(?@msy({ytFSqw*D;V$8@XxiHffrRm}4koHWdM z@G5t%<3f7&Zc9<#;lmb7fby({cPp>^>tqNg*#6b@yh;1#zU}gu%VEo`ye)c%(l8>ZtO{t&Sbf z483hYfQgcUiq}4-=L09JZeJy&v!Fafg8(c3tGj83&x@G~oPywZMl$fNK zU49ZG0mKn<1kXfQGF{a*`%{+n z(|%Fk7*Q6P`Fe)E`k_@9LO{cRS3h}(M7?<8^AT|7YW(hGhL)TidGfyO+?)~n(1x~@1dyv_#vV2ARBcdQ;~~435XX0SIl9HgW)giXrbZ&a5paN4) z!J!X@2J2(ni+!B znfIMfEq1qWE?mf^(nO8x$@0C=Gk-deuQSCwU{5omxV8Et3O%1h30CE5JFp=eII z+}h>t9EOv9B9~Q#-Z+TYK!a>`bCkpV!uwy?d?d^slOKnmwdCZjTf(*(QDCKORhMfo zT&c@yyN2DuDcG%OWRa+X%Q&LYiL4qWw^y!w}d7}>+L8~uds&0@p| zZ9icwH0kp^3F^fvf)?ofN;qmPF9+*`2{8VIj5Fce0+xU?Tj_jL%@^3O^has7?ZwqJ zXDzEiQSGb+t4q%t*x8*yXbf*SIE=*^oi_s`DzZ1#@$DXr!iZUPeJzkvhVK1R*I$8X zp#vtSF^;?7S$G8M!$Wqwd}nV`b(h(Eo1!im8Lhwj+ZVEz#vfM*mUZ*iAsU7&1RxEK zvm^9vN2ywiQ%ti5^uIVb>XlV1$roCMEWGX=W6cpBcb884qPO)ebjM@K7fJ_KcHhDa zHLj=0aY1$W9rltkTORma7uz2`P%-3O#1jdoEf}1P(Qq$_`EFS3{ybf{IBjtjd%9;v zs-qHlw;t!K%y1UaFJ&eTi5;ZYI0cGzFAwA=t?ZfpOh_6SZ?Xh2F8+A_GEa-n%?{G~ zeyr_5?^w=QO52#jGCbG<;_mt_LjPwyZxix?bDAc5z0Mg|N=d}Exi5LPXgu|WzBZj6 zzShui&!hC;GoTM4dG8Z4`jnTWlDkch8GY7{LBkS_DW*5(EM_YC!r(m}d^3%h&tj8B z(sJtPE0F~J1=YA^2aU3WH|1mZEkGx7cF;?$5?Mpt15RCCLL%L$LUKZ)hw5;fJrQBt zA+kPMy*CdNuED!B97!9GSnxMJG=K>1rhg-BCU(K(iW;znX9?+uQ-t1V-ph%ZO$cG4C9Op zUuio&I6y{V^|)nw`)a#;_M0(i8q#qZG6@~7LZv`Ung%+0ERpW3`ZrOcme3Uqi6P}= z5aB2%;#?jEs<@ZJ);APqlzv_;-tJth%3aqQ@~z8?NI8Fk49G0v!tqQ>uZBSGQje6R@(M^-v-X&Z?{H?ha9mE^a^<{TiHRdpL$ly_(2C-w3-77y7&pH>Gq1}+5i=;&c5K;) zY1;Mi%M(g!Ub&a{Lo`Ev<#H~HrXGf-u7>_+7Uw@^ZmB035`g)osVa-EC`LvK(Xr9d zQ7qQ?XnQs?l1$efI-@&FB6`EI?wQBvJhkgMyUQZGi+ZekR`X-ScyZELzR#E!VaHdC zO2xp1*i|yDhb7Hx2lwgD_(pSgJGsdRs!*(mC78O3A>vvi!N1gfYnr3V*YoZDO69Uc zz&Jsgk1X##6Dm|ri@OiqiE=Ih{>p@s|DGWBiSi@QB{AyyNF+p|yoV<({NVOf=}CN4 zq223>?Lp8m3s{WoDe=Q|R|~l^$J^6+Awjqhnnc1;u^8LrnZT_#raAWQ1=R)vZ1>hN z3wPAS>SfNDEP3ztRkQ8v8jW9Q;Y-@J6msjsItU zfamkc6e`SH5;ata>`Lsjq!-BKJ#Y0qm(XL`w^;RTSP zkJjkGbH$=_$HTP39vA0l>4P{$S*AQLog*9FF8Lz!lXA7!y=qWnVm9PT9!Ls=c3qX| zokoQbD&VY87%r;&rT>$4eQQ4%p!8{9>MaGvl3abAhd`L)UL3_jm5xwwfUK{Hh=XYk z5C75S-<2<_REh)nbmRz;asI`C25L)w3xMtDI>bUjlZ_9RtQC?>%lh z5i)R#k@o+{i_2EKWBNe`NgQX~V>xmV*C0?Sw8P*8}=)dj9A_e{61?bh(X zp`^;p8R)nIp?=uY)n}GtUtl0S$6TS@mm1tqNU~}yue6Fb2t6crX1+8T_faX)E*eer z{%G4w>~-H?qv?-h6=e2P_Eg)%PTN}s8ue@#Qoi>3L1-4ThPTn~x*!q6m zK-#UHXf%Y0_*Cb}KLVX)s2633vdjLtSY@%}ZFL0sHm-tk&j^lBrd2 z*DK8Eo~?<>LvLV1fBZwK>y@FRswR`qEnQmm61m%LklMLssBYmNAN5|@30u54_!<+^ zdIImV@Nwql=s2h_MCrHZMU?5)1-g&w;wri48&}9|QoQ_VBBFj^Oo&oJEOWV@1tJLk z@`rN|yut0s6z#)HuDoy_NrlJYX()E1Q>)93~0=dGpGDSGx!tmH$&S)5MU@?Tfe zx?^P*cwA4va%tyUX$wZN7|d{D-o4zuQ6}FiMqS=bdUB@p!rf(0bHoU2jfS~jw3}m! zP*Ci*@Pzd0_t?Ra6p$Ly!}^%jrrTNRNYkl4W5B^N!5W>Z6kF-O9~vfqBUbwSZ!93| zEMD3#z5g^?`lxNq%B30NL{Q@eC#XK+ZLD-9C@o^7^H;6I70pp18!G5Ik#UDCPpouk zyX^htMhdu;H9F;F^Z-p`h;EAU=(SZ_-8@TBa*e8*i45~(qvZoFzdiFE+za*&zC{a! z`k*^zFm=k$hj}l#`wq8waV7JUB4q#Us@xq#O96$`yrqrq>ARucQ+hc0hEYhM*m%v? z8OC?{K)Z+=7q|Rc%7NmN#nMT08k8IGu!q6Y^AfU(dZs zr{QF5cZnD0&=oV?@pb{$fyDaHNyDvyF0%A85GpW58A{_B5731Tw$Tgu3>e?gQ(E2) z1mMfQ{hm|e1wj`BRD%~LQLKxSi(m`9YZKzOsl`iJHr;4A?qNFMoMRq4a|io*5}7i$FGlU zz0$EoFx*V@>AG-BW_nf2kSXF7SYuv1dx1c{B(M%USATF`f$ci@n2>2)#>*1w?q$~= zPeJ#*CulIGO53wFP@S(OAXVSqMi+Bz?EchU>2L}HwinQx%8Phm50&de^WkV{-ux32 zuTZoplR}saBsGN;&FhrZ!rR?6A2mwYO1GDYXpE>7MJal%`anWeW~ZNk4)=m6X*gXb1Pt*v|P5!jNFP zh0yA3)4@dLiNjR;IBP87JRm=oaEu;)1?W9Q%kM%-y8$CoP^dDy*W8?G*f@n@A}>=h=>+=flyW3a&1GXs z5I+*XeERL#)XY<{r;ck-S@kqoA*yO@Qip^1GPYkD8nYyhCaB<}F~(xF5qBfD@kvNC z*FRD1`{-fi^`b zn%xS8A6@&tIml31UOt$ytwHf1<9vh={tV7x2v}Q_h)ZCSUq?|uENM>Ydcb`7I@M?F zV@mkSkH}8G5i|GaP^`aHEaC9FvmUXOQuuceyW+cdG)bUOy}N>Me8Vb zn)<#0RHaPxG!@1kF`6Kd(DjU73KCw{=_+T&vy^~VMdK-B(4H_$cVWnK41udg%?(16 zH*0PJSpI_BY;2Kic z6eN&QvcgO#gPFp=1R@uBk1}cVhUO|)e6TmUo0wtCAk$?&l?s+Q+B8V zHp3D=h!Z+7YD{g}nQSx4nZ4-IYLJ*4dtx)Vn06<9L4$yz=y^-Q$$s)(%gdgL=TAxl zO=_dk^i-VU*qaOG(wX5hgOJhyoFZo%GrPmQ6|2J@lksNTN8sAC2ovx!?&kC_SZ!D? z^H9>zvmO`@dGRGWVjYUSD2h{wUUP4E)N&XKZiLHyDk1R&;BEP40&<$d4Q z1oY^I)Az#!()KWlS;^&}H8ZF;(FR7gjuq7}pCg)QT`2g9CDy2(%YJuGUBIV zL+YSFeplYuOt~H*W7^~GuR&O{sg)S__Pjajv;%VC)Jw)H)!)pw!c+}&T@~t$os=wC z9Zsnz-UhXbk#A~U$=8z5UxqkctCeAGs~1R^b>K9vNf>?BGknzTQT&~+aN&~|?*e2H z1`-FQfrh4w*yNb^RH{n^n@_*ENt zB^s%T6ynM*b1KB07G@c_xPE6`AbxAXFe76|AoEuqRBRI=zhqPo;722oCMh!x%O11U zbpCWzz4!|(m!UoNFqA%42L0q89(TMz$MM?mWFCiq32d!KH~! z`u1DQ0rA}qY8c>FPU@w1XM~&(_>y`)^DyG3=A)<#kq5qDUMU-Cw0)`aqxIO6ljd&4 z@>U#nQ;Cb0ubyfEv7Ry8p{nIt75j+n5W$r7 zsI8#Qjm2Ik-z;p`bacsV%L2rUw;$46gELuvrw)5{U;O>)#i8=RlGRL{bK1D5(#^kY z_<5eMx)jdW z7-y@C^8Gqo78=j(;^h7Y6u&*dqyKV%yJr#JcS+Ura4kT%+qt(JyJ|?_QCanadjR~47-pb@{~Z{0M?;@2JTUhVej>$x`~MD>?Sb@LA>dyb8DtdF9-<|t>A z^JxU)ax}fd_{}-Y$xa#Jp>le<1#H2uqcGmJ0Bh?Ddh>r=hgzU&vG6<>S7V?)a}mj5 z&BK2H(URWn9&WlC7ePfUVg}1n5l8P{QGNN`T57WE^er*SEpzU*2^1&xuFc`U8_jEc zc!G_F$J)TXM6VgHCHS5_E?}hiym&-|Zrh3*^g=nJm7fUq8HtOwcjoc5u921?;O>#Q z*Cphe6xd%vHS!tl@1tThV;`1#B7C|Zg6emb(y!gbpu-$M$THvWPbA$k5>XBS4IQgM z0gu$NO!hE2PBs2ms-%A1rlk|Vy$;!Gv!9sOFfqfL6l!2~zn+wGdpOVWh{kp;)}Rcp zuV#GL_3L;th-p=>@Y@89qrfFFhiJk@8zClM z9_9d?gx9E4SE!{>ieO=a=IG|F;Bl2ZrnEXT4u<4m;fyaOmLH6>5r|n9ND(j+ zo5T-O-&_g08aJNE+@SC{mBSLF1C2|M!IB!;VEBgH%-A;MO-OrMJ^v z`{mEfpY|DNT7srD7Jj0HSS*5pCmp_BLqMBo0@lx8ypNVux45MHqDWxkyY8uwErO>R zTJ(R6+|OyY0}2?->P@E`(ZF-ez1nXf2;@tt(#MG1`xVNFyY(!oFa1qQ`_0u#-!MiR?7();~+Jzs&$ z(ukVnv6YKkY`NM9_33Ko^9EqFJq{F!1T)Oh44Y8hg@QgDc8VDP5}a+EGkDY(TuYj- z_coWpG{st~&Ali2Q_I-aaBq)8-?LbcZEGd125fgn4QTlm68xUcpF8p`huABAC?5br zC{Thsb1;0HXp$6ZLH$RbrjZ}HHKD%KnZF#}HZ53m92k0Lg;mDBgDNnx{0sPCBkG7;1_I$l7M^uhwV`~sMbd#so4*mEq&;FIy9)vqb!md|oMPNwN zyVd|7{_%(iWTGgCwN!kWbD#q?bHlk{cI`SJ$W6jufapJ-@=i$m>i|A=;YItwy+XW) z-Bb|BZI)HT@x9GSg~luEmW*06^uPq(j&R8)Pw4JX)!Co1J$V?d@c@jq{Tyg|Fd7}A z)d!j__wN{KwhXk;vqb1pQEVFa2Pm6B79er?qK4yAWyKuj)vWY-dB{)#f?cz##t%1L z>HycUJ~ceL9_Cu2Aa?LKcawVXZzdnVlnuXxW~PiO@XL*;qTLK|6p!$9RnZgD7|9Nb??q zvS*V2B{=MDED`6b4>O$6DOSZ}5AU6~WbC}9nH%M6KatdOa*g2|J-avw9)OPt5Z0+MloG}dVm z#e0f6;$>A+<(+IPdAB+;W;{;kSwiy^e1M)BKJ=-8AXC-KrKaQG8{ejkyl&tP9^0t{Z!7-0{uGE;V&qd*_9NEIp%xEyQlpo9ep4C!K9d*YdW} z^^agu2~##jwdC@-Gj}N-t+7XRMDIPcdjWH=J4f!kYMke&kVR$b(mO?!*rDN;<&jL{_QmOCGvC_+u4#5eGCjqKi4tOE_7 zUX8*=7A({b&e*kyjNH+)9O+#Y1I-DJS+0K={z;3B7n$^XK54|p!ymht<Bo#ZV;98vQ>4k@`oOM%VSOYw{;)}As;%BW$H>GtLDaxd z&=`13>z_T7pAd)C;D~eZbv1pah>~oDHP=~&gh!KVcH`~zr!sSg2wB5cvV%2%;a1(W zqfs7@_h^?LQ`ei=HqtkVvi{=^VIR45puTTfhEnDQazWn3M6qw%EMxOda0&3U-8=QZ zLHth@mi<*3l6u$}_m)7b@GW<$LxFCLdp8E&BjXr{FgT~J57QN|kh)C391B>Im1M;s z!iwTId$m2N`z zLnt`ZY7uL_xV2~RvVhHm%fw5#MrXvd=jXxtVJUk5t;e zmfeC$_$F+oV5`!PncH2660}XYpk*9t2xc_6v^^^+1qq`o+n4nmkvWueuWs+2%Y~+Z z#HCJFg9}6k>V5fxMqWaSWuh*A8gPK)hY8_$NChB5@HP9Tf`2}G)4$zvfKddEKGXcI`A~9Z|?zZFs@fd9`JRYzcCDO zg8Pe49KidlAZAR;+S|~;m-WAKTc2tU4J=u7p;ZMOjXl`_l*o0GLY@p>(#DHPS!abl z1XCT_&COW&@^mycJ2>I=TWw;D?Y%P~ENKI>-;^E3jZ1n@2sh0BzR)!B`thS%mBn|i zxBB@jzxlpQV*7~a@_oq~MHtcfMeny=q<|VM&~zAp3nDPueJPZ zE$7^O%07GVE3YY)P-YVl?`vgM(KPB4K$(T&3d0=w;~flj@H2bSQOie+c@F)iq!J2I>CJqV+f|?J9IN2Xad_MYN9g6iM>d3z>VFBAh`zEYzjb7Z~r z_g03V!7Vjo!=@x3;4Hjit3=7ah}{*10C3BtTJ_aUP`K+IAHf#OoYOn>4i=TDOy!@s z@UF3C!i(4VaqshGVPYZ{`rqVkg{+RBXFoY7>8RNHBgVQ;ku%1skT2AD&yvVGd1_rC zU*e{{W+4!i$zF*e9mJI;{i%(+C60nNp-?IZ% zrm0W(=IOtEzi`ilbhU^@JVkk_Xj9BA<#1#MDOW20)1Zv`I`e|ax?d}H<)AR@crQ_O zIOZ?~DFOqq%I{G6uUkFPfTx;%kX{`wDHjPhAlPC#QKMbpTOI2KPsG2M!l}i|T-{(4 zp6L<$s)NizWYnRe1uuE(U6=Y!@O1a{tYY}~h8VoE!{^G{$SKClxF_JhZSwK6w$#C7 zU3sfA$=b)R0gwikZ8@2A&`)wNJP7l;&-#xJB!!+rG zoXJT8oU2sxE63!&tOvBt(J$Gci2@bTokxvSITz&hThzP1c!e+d{nq%+Jm1NNq?d1s ztp#vo-i!&ql0PJj-hEApYWL{%P<^Q-RuTES5S)XA_}j1ep;q` z5}e+bDWU`t3wwV-w6w6ajjOVjMQCUMf-_nI5KiN?JLwup9E0>;Q$w8>ouV0>0N6L; znP&hZbR-f4lL}00sB-}Nm0_GAIZT;|7URy%^Bg@_zHDHfsUF|q3iJcRZoL=yk$p`I z55N+K6~L6%g(z(j@x#rTF*m_7viw^{sQ&PIk#CW)dV;9zYW?Iuy9en@TAG z7w&1J(D{U?QX6|crk|znNh`6)t1cfVsLCy3KfZLS+Td_G?I&KJmzBJFKh?*Q*k|g* zy-3-V-mF_E){;0f%F}oQ`-X-@SfvKeWCq=70(*)|!$VF>(^>M3pT#Iyj6vxO7*G37 z3hFn7&4QxJpHq8C+^ib!(X{N*;o*4lN#Qih$FNgg=S3{fdaIM2#-!*$R;BmUu7y)#c^tA)N%?Asjo9+aDY*cr=0(1^Rz5 z`g>}1@zU2q?R!DpoS1fx+bo&|pu~bR^xYZS;7p8rui)m(6pJXnYR9ZV(=PnXkYmzl zxc+sbql<%{jo+t}>wYgYpg#G}6u8-Y=MV_DyD%C`Q-oYKXg~-XyHQeoBZgdl#k&BT zWA$NBe3*xD)rykF=K?6;+4Sf9rUD!P0-fe-W6sU&B0TsntM&J0xH0C^yTccG zS!fKTg?VAd&hLUy$DO!1K1r(X!sc>tl)59L_E-OCqQePhd+nr;2sm(|N2I~7%)%IpM)MC1uFQE*><^>NwKucCzW1A~zDlyjZtqag@vlg0+K31KS}6xb}_B!KEG5U+6T#Hw;uye@4D?@qvMIb4<@TW6vKcJi#HE7(S(C=`FLy!e%}q(t;r3RQoWH9TDOb8+RCA^Is z-@F?kqx|{Whdy3LBH-!-Fus=v98lIsv0~>FOcc}fg0|FqB)BpZkSV_b?&TK3JIyFG zD|Gy*BAd#1m}{l+98j&j30OU*t7x;1N_T#`Ofm{yDcId1&;Fa!%qyzAQRAhxDNL!y zbMexoN;8-BaWdNS=AZ-OI#*Pa5_Oc&l=q?SEdNJMWe(<4$@I#oY-ZIxH14Gjy zaEgJpSWVSZ(mdVR|@mXO!G(09v54YxG8y&?l&j7fW}yD|)H8CwJA0__U8Jr+7r* zU(cLc)#JnafNs#h=gN&>izJ}E!hEw>WWKI`hV~pFdh^KM8|~T9z!G1WVb(R2-Z1yX zNMBHSfs&MoaQdaulJjDUX~C})Qb>_k4nspWdQWXrgD+Rf!fhol(^{H&3g;_vXO)>Q z+G5|+v}PA+r#-LBfnju#w6ksL`%Ch8yBijwzwbsjLu1j_7yl%nsLP}3LA>-(hUyBe zQ&P5SLkeV75u{OI)5ujrFues&RArHYmH!UV!fJ9Q8mJ$M;y0haCT^0;Ah*Qp2X$@!v%Ry-N$(H?|W&B;J>S zv}&18#rrwq=?3Y~m)=gDIuJn-lz_z1`DYm%3|Gc2`s%9l2Zw+kczY;1*8st3LRSrc zY3yL3JLsQnt)QSytDd5ix#0vFRtr{d@p=SSkNE*8G~fuLZjMKI(RTcc%@q-b`l(ee zdzEh9V!u;r;VtFe*@|ET*IaH6RadPLFp)(d)knC0ZkSwDmyK2aBE9FGncbllwi(yP z&yixD!<`aIT2;T}ipdkmtCexUzLQdtTToB8Yk1|?B}`d7!GQ03b$D7CGfIG2Bh>vN5qFl# zsI)U9+@88D#RMF(?rptt*mRh*&x8h8HHwlXzhO$6Olo+V#S%m&OY-k4=T{p3}lugq58Zl~ z@rJM!0tZn;S#;`6c$x%zl&H_%aw|xCIlEx55DU97s&KzB(y>Gd@QFo4`sb(J0cfW@ zP9HX}Izw0PP&Jr>xMDDkO`}%Y-&}ndo_UeDEuzl}d~rCFmNEHgC(gfls(ktZa#mUw z6N_bnwPqo;U=UNh&sH(>PS~M-QJZ&yrN7^)$7wDMaULZaVj%#*VJ!{b?(xF5h z6iWMSt8TJ=6Pemt6xyj3FnI&~tA4i|^$Qwp@AAqWDRk^c7#0u=?Jh|7=HmZ^Zox@{ zZE&aJ*{9_7E7q|xc5Ia|dUe9j3O%Y;8oldB)}#|?)$dEn1g%ZyVo>HyoGvroW6YWd z&7w0+!oQc^jwG#nKhGs4@wP}W(F&M22rzO=pEj?r{eIuxXu7|Z#>^?&;0PRH*M#buym*lrWi-H`caYPe%ey;s+CU~8rmMVECM)}h0tf>C%sHD zSltk%2oFbLl zeD%MHqBzbXvU!F^mf^qlO0P=i_s7Iji;RJaSD7@1SkCT5P2t_0Bui{XPh6{E^e-4EED_Z?xA|scRx@e{ zN(-fVF_D>U${ z0&*E1!R2`W&pA#oX=g`p>R&RxBOzn@)o zcBT*A5pdj_*o3Z{ipLj1whOUn1?nEs;|^SoFyNG^LHGe#QO$|=Bm$MdpPVu%;DQz* zkMvcB^Z<~uN4t-7qv%L*QmqttF4BsaGEJv zUF}5saGfYIF8*^y3DxBc8S4Bt-&4pV@u97$J%*1A7|7xX^u*V3w6_0r$Q1a#WSSk> z2m45DCa*tsiBKl$sx8QVX(OM9Ii|m9i5uf1iAcLM;QL=#yT(-nwLKOTM(3V7zQc?GJ{400uMf6Ch zfDg&C|42P^6n@IX{SxT%5hc2L{MOG;#$Z+2vXmg0cF6onIz#L=c*Qj?fHJsx{Np}Y*yR)ty$dKc%d%V9g-b+}4219C0Yn3 zL;C2u_o}@lZ0Y3Wdw$|8apjU<#7e)N5m5-^W{1;CNJX+~_FD!_KSwb(Mc_Q~CnWyM zzy*(5da6>01_CT!LbrLZ=pk>U<3}!fxJTzGo<8ol!jE zgQXvlo#Tv`%dba5j?dM$B#DAb>PuS+thb> z86&YBr*#hIK+Mm3r*vv0GeeP)O?PvuCI$w%Yxiid_Iwh6!``R*id;Np;!Q!!>NlZ3 z8Cu|W)x?OztbDD3w2vy}D~S+=9ZV}GW%T2`u2CwB&)3TM$a52{!)@-ZT`OB&ZXmB{2SDH!TA#l-8v^w{zi+y zcSse{J&M_$pvxNv7UtEv^czpht$@n(mhh}8+Na^0nTUU*r_ZLR|LB9<5^Ep&&@!RS zPbOI}ug1MhiPOMioR38*V&( zXv3ZTMJTp~*~=e2;#Rz=lDHW{GY*ZufXZ~M@V72JYrCE#ThyS_=7EWn+)Vqk6pYPz zGwiyOlGk80G~lYGCVQTu;-6#19`x>n=?*yP9wGY}3$ZT9%nF;@gx8y$YW_{0V(`Ya zIUy(>l($L<*w7cb-9}G)(u;^#QRyYwi7b35HCQ^l9=>IRHASgtVY5#a4h-kF< ztSMJi_$9CY>fx5-VAwsMr<%MNk*gSLsanF-cBkI0HFhQoS8ijSK)rW|z{YGljJ2+f zmKv+x_C^7+6&k@FE%jD=Mb-Fpxwnl13|=-a zjL9bV!8Um>E3Hsa`yRY@3m!U0c(ECKPRLEuuE+POp4Mmp!Jg}j3hPS2N21rO&XZ&Z za`eX(3n*33^*(!=*Di(hi*s556~6xdnkRZwH{GUD0xg;yS+uV91Wox>aOQCP)EqzU z!U}~+jdXCs&<^0iEur_!Nvs20%w9cZZ>2xkGCD%DE=Q5q@frMOtFAN4aX%J}L#*I5 zC*1yKEN=MgR7csOZf2F5_I1fUkt4Ok-@}jcZGhPE6!U=GUz4YAg1)_;AX+#I9_Si8 z>Eiua3n9{GYHJNUA%{e28n?mf zohXz(GUpz=78-Cn6Pk4w(d$N}nNNR0gkMp0wT2B`+#^ava=h|l8HzKoRtY{-7Kico z$y?Bc5uP&GN&4P2*GsfrOVqIB9Ko~q#@)|#{V?v24Phknltb}9ntM#dcIK5hbxLx` z2m+}zE!FxvgRWA&+c#j6Cnq#3(ZW&MDI|XF=^jPhUUq76xz4?)j?k5o`h>s8K%FzC zbwtj}Oy~PT+J80R)MOOZ`U(vjWB|PsDEq?((f96K@IxkYqGs*y-IlvVWAXkgLa( z4d7iDFd6qMC%1h4@7)GQ>dBjM|Gr>#(jLepyFybeJxxrMP_T^J;l?lndS+h~(#wR9 zvmNUiC%QZ`1&iK$JKhM)PpjzV7ZHu`toaHWQXem+v3+!L?zb5nI?c;=3 z;}f7}0t1~H`})K0s_d=dHY4HhbX*%XXPGCwIO9h+ZFg#EqW3ukK~7r9z!PG|x+pr&gVy3YoDb;`BtuYXGG-|`OJaN63+ z2CQv&NnwK{F)*6BuQE@z}&jk;`0UjRk<}`2BYu&JnCY8JM1bdGLcZ<8E z2QNlU%UE8m?3vjmGHFqs=7vh9ynv_ltMe~$S7q!59Gi-{eT{nK+Un;NOX7h_qOvG( z9~A3%;?4s9(KPw>hlxtdgxO1bstj73B`-WL|Gjcf-g)R$QQJBwZmLLi>*kFbrcDuW zL$k+`-2L2LNgpr6AKa?h&tJ|bz7N*p#Rahc>^3!#!0*?M)^ed4ahgHkizFihkx1S? zSB4rWYrhaST<*A5)sPcNQ$zUrP@1p#KA%IQMEr0^`=0i9j^x=Z<-kbuupxON_X8FrPgu60mgMGrhQb8Y>mh2&!|1sY7# zk6GBmdB*o7dT6<_|I!dPY{EX^|IKWy$OpvtktP5-1p-QK7#Y-qwY%AlTS!PQGo7Ap zb+xy*mpf`Oul_DE+_y9$c^0B2cuInt0~RNXyO(n_F+v$W%`bq9t>tSi;;eonOe?YE zA*Z%@4U~BMf{H^Mzw-V`iP_bcK;E4K$UpbfJU$HQyv#-8Gm9g6x8Ec{T676_kWK3Q zrNC!LhVG8MlAH1Y7WC4$G{htvrC*eylmC&QRj)%v_N}oCcYx4JiN$PGEEhl1YRBImsvH#%EPm#}lAH3CV(eQ}K7=At6J-^&bQHJX4QVKE4wO4if zWj%HTwF_VI93);Uj59B5UWhyk%{_d-o;lt5mOOc+(Ly?Yx2PpzG;UXZTk`uidfAok z;EfBBO*baHV~@_Qet+!5=GJP^3oJRQ&-|4YoObd_mhz-2GxhOwXL~I5&)-l!n<s+5bxP@d!T+3hS%t?KwistTJzkT8zcnw(e=@MuH0jHeUaOU51v5Ym7GTy50 z_l{*2XpdJ_C(y+|?|vit1HjeL)r{3wWfJT3ckb3Vd=H&PvXC>AlIuBkkJYI2Flm+l zr1asz63z{rcnE3VviB4&({A*>l0wT$IMPlhSV}T|9L!8{XJA zTB_4|K=IHc!Y#BPaDq#f)RfBdQfvKNpom#G(LT#s0ek&&s2{^#gVw&XnF=IkAUjGpIygV26e9wKE`h^l> z9Ej9F4cRpODDTG?|G5RWlk^ciD+?qU$KtUf3Fa|U4jT<&HSQv?v0}rMX63nn{meqQ zHNvnvBmnnn=6eeG)T*LOoZn;8ltC#MN&(|CdCGm68q0V;$l&n zE*4*Z1%+A3aZJ7(kZyT**FCC}jUwUP%cRjP@^-Gbr`8%7Nt8&yF@N#=EX7I^Kx$f@ zExSF6zV#@bikDLZt^YU72cNHFbB6j*Q?FATk6cb$CWEYVrs3Q-uotMeHm8Y=9*enS z&cNP`jKS#f-pVTQ$CXTlYBi@vUZ z2_mtHj`j=SM>EYEl}G; z^CxQ(%~`g@CGX?+Z1r5g+sT_G(OsYX#l>yA2>Fk&MY)$8OIoYr9&5i#$~(i{sUy~J_6Scov(V7RddJvXl3+e z7nmUuZ+@jbj);s@VBZ$2mOCGd0?(ok>jPg{ylDmfyls^zWZ+k94D9)*|bIV*i)A5T=E%3bLG!P-r?b)B$8=*eEoHV@)bT6Dj- z==h22#DyX8_W@gB^B?At+vablo|jucKD>zD2#A$Ek;V>&8gL)s)-W@bC2&0{umd_H)kaD^j{VR9@xlo3)w{x9a$;kBkxhD>!2U;K zyw44gEOabCBJpI{xW=1rK$kBCjlL2bM-{`ERd5yBQ}uojfS8IjkKdW+nt3ecL5gUb zhs^v{Qk`9dI8!EMlPM=)^W;D>rI9AsHoXna97*C~sIoJc(?&v#Y!Uv5zjK=X#(;8&~+t;4~;tx_c^BY~0G4o_i&EF9HqIQCWC=E+@( zN9l9CI6cojLSrPS6fZySIpaOo{J(+hsmcgDJ?8EA7)TUxoV@CiD&W8&BsuCV-ET?{!72mC!=h zkjyuKy-_JI=|a2G-+5={rh#sd7k{6*NFA8C567SGgMi0RD+Lim>hr;^)li2FOUm-| z>fZHL#|Jn5G$xB6$=tR_LNgN}hp$40g$FxHnHnlYRa(M`Kjjh1r|*}!_Lh1F(}A~; zkt>5jq(8#*#a|`sYYY{=r?JvJMhih3<}Mv8=K66dKB1R1`fR%)L2~wIyg0JUOaHS8 zGB=;z?`0KYFRgSo-YT@6Vm7m(LthQ5p$*|)Hu64pdLVr_$-st=g}Uw`hoDL+;i~ReXRhHCj&QJx-Sj=e(yj6mQCcxe|cW}o&*kv=m0lxxcm{OLqN+Xswq{` z%0~rgaAtf0bSO2;AQAtkYe(*$RPYN_lOY|a!tfvYtBF^TK|DU-Q?HJq6wAwBj+wzB zR5>dPTBRXaT)lovwx;zK8LJ-X0%j~G*dly*5Vsts|XPmbYM zwIE8{=cJ?3LI1T^&kBdR2MX2I^af*W2?ck}-1m*MA?x@L`*Hj9Xa$>$%Y5^5)Q``G zp|zK;88TXhS1vH;L&Prd^XJtd>o)^OTDy-?&XkoY+Yn1*qyu#CBydwJ6$M% z?GQy+#l_z5A-92+<5@z%QTeVGx_aH3 z?vPt^FEE^>XWv3HYw08s*C9y&8nph%>sYz%$R+S}wQ$>%6kNp1CJgutK8y+hF0dzUpfEhN-FA^qt`tFnLCqt=9)_s^V zA|I9&LHyd89)iV16qjB=ljS0(<4PS-jC(WF6{4C5tn%oHmiL0RhI++oAo?Dzd^Tx*;FCFax2PqJ309hDE|4$=iDw)*We&EJoX4vH~ zekLd_p)?%NN-N%EG_hklcVS9$*la!>@OghWYNbWn5POmFC+yh0rw`$NXm z3-!G68jIcacc6vB-n`FkaBT?S^dw^$%;>KgraH6?hir}ILhRUG-8#aVSQ6d*WSW=W zLvp3PqnitY3gP5)1|gy&M26#Ku)}u8tD5%|uH0E{5e)5;dhgg!Q8e?{!IlA9{(27oJ%9B@g>(v-v+-T6_P(;%-GrI!hUP0sR(y}*C z_5EK-;$}>8%!Ax}?_ib;dBB;zTUA6(<451vOTUcH5xih2EIDa9IsLum3CIQ~Q&HIg={dw}jUIpKhYrbRh;R9YZ2DGp@7_8DTT# z!sIPx#}yx!I%giq?Kmv$Nc6z~{6JjZ5UfZoYCv zEKdFkvKDv!y{0%4{s*l$b9IU$i_>C+CC8m#)g-zGT6@(AD0&Y+KiqlZ+#CPtJcva( zw{ULRoO%up+oUEejol}f=C7huVV-3bpm#M51NiWH9J-Ny7ER~6=UCG335ZkRDw%z< z0A0Oq(ll*vA6V3Xn{aKP?Tdif^9@JwaA=uXy1kQI`>OBYKMJRlyl)9$)Zhw8W(Dzk`oj<@*zFTTsqhUs1S>TcF@vrvX9}>OsLdg{Tq;==cep^lLqx&{1%ge}| z2M5nzVNO$aTlfF2t);rKSw}DKI@X4 z`E=uNoL7>nCF0+pyKBIJlDL*z~MG_m#83R!d z^RaLKvG%eA{YmJ7#C=a)v?@83ewTR1=L0VqHfPCdg{-DK})hk?3LJUf1arYp7(q=~>NUX~67JVQv`#6&=d-vQ&*tMJTc&?-MA82LJqf7E@R}mzu(#T(%}=NCAPu&Z5ZURdOXhA)itiU^L(k+ z>Sums&)}zcur&hzm?e)AtDDIpYi3nE=eWrU1SCLwynUJe+kcjsXPA)Zssc7fn987i zrA6QI8@U1#=%(Oh?(6*~e5_!`w~M2yKf7T$mHN(B`a^1;Eq*0AkYtD#AfR_4TMo5f zp(Lo1&p)qX&YgfK@kO{4G?Xe(P-bz*xDKDUJj(~+aez2Ax%$@E;17Z=aunc=89Yfc zN3_n5MlqSAW<;%2225CU&8rV>DLHVeFAPNOe!lsc>p}0G@6{C!X0wOL%fjYs;D*4Y@!!A_$4}IG8)FPafnaWb zS@kIX47t0_{fu#SAwDk7L5^>&0{pPMY>t`$IngM}IBo`SO2&X2dUO5O_h+*bpeiJm zOe_Nvkz7E)TgZBf(Y5#Jt06|%U&cs0g~JX$+v+h!CZe=?Y9s6742Ssa=@;uIMSbT%rFRMsq4z(8M zSWPy0>7w`jQd3fpIWz|^e_gsbI;jj`MYcHTx1z7Z3KXyxjn%yBE)#YrJ=Vm3p0NS` zLCZh6aZ}oaM^I{;E?-TLyCTe%2?Z1Xz1vm6lA|81LE+s%;Cz`VIMH zvhr@M|KqAGw^Q^Guu0_=V+V@$a*KrQ0-Q$oY`_+B&uqtA;(WN^somnVIwt~I#BaZ? z&;4rd=;-)kafJGzU#IeZ`O?)S6Ko-%X0ASSXPtPsKV80x=k_Wja` zc}Gcgsrg`p7z_-y_zC7?4+E(Bu)B(oBW}gj+Z3IGEN--pne9?60#66?<$v+Fv^c$h zn7zc#>&dl$`u3zh^QriY>k^@JbN7IXXu~Zdeyh7K*Ra7Z+uQ9wl<8u*ryp~r#B^GT z5H5Rs7gIZwL!OVp`}Q>yK_+BIfz9(g1E?6V44e<4OT)@*{cPrEiD5DFf}i<-8B2cU z`6RKF3FEQb8XD-%H+y@bAnd05hkd2TTJhJf4+>V9!lxLQKU~G+zDpkMD{7dg zIxOPC5%@6y^=j#f^bIB!9y-tI%{H@Ed&o~M&{P$zKJbL7&*IWQBn@DaP_#G?dOayF z8;1Xm&xj!*z4(j}ov(&!i89v&mIbjv-T0#l-+Hjlo19MzLo*cuntljtb}`)n+30|v zIVW}T7BMUkT5*YNF7^M_MZe?)9820=6KDoQ<*Di|7mty_2)=3451t}*kZ%au#BcdOS#b|NM5$$Ut*vx^43mTkis4$p<% zKEbFCM{Yb^oqo>v%=`+nBJkn9>#{bgXG<}6e3qhaE$tSFsJ%6?g(~9y7und|UvoogTYhk;^oa07KAa>i+3S+L1E~;?%{N(6Bt7CnaYdo` zWO5uRc7?P2JHM)UAT8x~O%Ar(*FJw-jFRYD&|0h>@4B#ts|RbcToieb1ciP`C|^OVyR zy*4^H>4yM3Zbbf1Nb0k%^ub7^CX;$rC7GLN9oa!R%5*0IO7B&`iESo%Tku-yo6yO; z&{g7hK@mscIM)m64?teR}`Oin#s=I!KRU5pdo>Z~2XyzLwgUx=tlOQr<5fi!G9xY6M5O;{9&8 zYPAJj?)J<62T^|Z=LmN7YN>;T7$gbUVvVezcW%mWc|APT%tg+Td( zRAvpef*ejeP4iMVY+PzQWQE;GT0QysU)GPWcCbk^i}0C!i>^b66^g@4CqQf|rH#dc-(1yMKXmdHU2A2D{Sd5igo!}I8k21P=p5Yp12AX~`B-cUUpA;ny4vw(5P>Y|?i^MQUYbVWXl5%FOiFsV9qG!n6gucMg(Rzb+ ztAi`pB1go&Ksg_S6|#wh#Nd#x7TQ3$+Cxt4gr`RyV3`eikrVXfF$!1u^0)O;Yy_(WrC%X4N3lRb5%!%T=UVj`s}kj1~Cb3T$=5<(DrvoRrhE z;*-k9?HSXKBe!L&lW~~xMrr%7#-o(hFTJ?WQ^PUY*XYQCDSX`+ce z{f`y{6VFK(jFDccWMiH2;FQN-Kr)HAshL24g{!VIwTrK`K>%N69=Yge@M-9Ad`ZOi zvCGFrer!+Gw>TS$$R&X?8k|X4Ayh`AQQ%O|SqaGu;l$oTK>^Aa&2v`T*;Jyi zu`Wj=mvryvm|ReM-3@sw8rP5h+961?<-L$fSK?&%4ov666-6!@bkC52&L5o`u1tMV zO`@_@#)%~tb{w5xYSi1_X(!rA$?TI~k+m|+27Z_zoOfXyXL^xuf-Ek0s19-ksZ7s- z<{U)qJpdM~@HF|-cy#wCUXw-3_WuKg?kGi@KfuYCfSht)nQp5uGdEi*^t?q6y%KFG zXtT$_`KXk?QvU-rBaTFZY(6%teqMv6?`{W;uMFl|FRu=!2v`s&qLgFJpxbvq^n;)T z(BosdBx~gPojrMJO$uoLv59N9_<5g@5JQ+f1wKljr2)2FIE=v0z4PP>7uq zMBq9}vSrdtC~a0p1`ygnc!l zrEK|dMx7iR7W0%j+l|d|m0AM<*=WWc=pzNw|eY<|_KnHj=Ee^$KoWAa|aydnjc7aD)VSZn$c8b8cM#5^#ejY_llMbmHE}fa9^fwFb-!NXA6b}V{ zL~cCDn1V(!n?KP9X<0FOSUA-sgel$fze|J6`O$5>sAr1t%XXS`%F{sSCxt_V48Lp5 z_k*0S#-O-|)VBTE|GX>0F8h_F-6aGf@Btj?p0NNa5I`y>FRwduMBI*?fSYya(sq+? zYb}vMN-oGC3AIC?07t5C{sZH0li|=Qlbf|{lJvgL?sk8~#GoVHyOtHiYGKKs-0k)9 zDtalTCS$OXIrLXkH@EZm$V=6eSG9qHVkH)f(RD(7yRvYv*4t?qqWvyJ&q*r&8Y%Z1 zPxag{Jzg5&Irm+mX%BQ?k!b$6RMJ25C03C%%5*{D!IxNrD`zCW-Vrz#6mB`9#;1D>HlM<*wz^cDGH-R$>OTzj&b-zh_$ z*FQ>XvwB&nh^PTuVD_)oDQ;8mZZ^X4_jBt}BL7C`q07~77)6I#bOFOuhnk@zcP>xW z>J{wRKy&bNUwWTU`2LMw5>|g#o}odNpU_$0ZS8T_P!goIFky&&rnX@Bt96t)(qqLEenJQDaz1hgGSOt=Yuh#W?|Wl` zvN&?lr2X_h=u%W5*n%r@!m1Tr0m?d>MdLLkOO*b(Q`ZR`@Qmjf3h(&>o=T~v-y>{jqEGs=mZvw&n%Uh_vbT-=rWs@| z)4gd+ylY48#`zvatJH1aa;%B*i6&m5K3HDU69nJ?kmqb;^R78&J-W#4Hf!yMzf?Eu z_j`LNuS*&3T9X5k$Oza&K#5F(WTQP1WO6ViaimoLpst7}Vu$i>)7Ju5-`86>@oc}a z00R`qLEzJwF8scxx|&+baet1KS2&9yvCf6Q?;wla^>+orwGrw!W`d0p@IlgvP})8s zPV|6%C{|8W77Jte+B`w0#ggUiz9?S5;q3rTYDz14tZXKA<$Tk?evCLQJP#s$6#3LNcr7hTV;o= z__@u7YLsmkl1B`kS!cc#iE8VVbos z7ht#)oG+oN!#_Z)w)V@NAfPXA4ll`R{=8Y<&lzeN8JGL_Z4BX z7{ft|{eLu_cRbba`^U>nR+-7>*eg3^Wgaui-Z}O;$ST>{D;y!akUbBMO_G(2C>(El zW}K99Y<}=dVrC&E98w#SFQl)s95U%B;a?ZKnT*%u9`KgBgr9ZdF| zUq(Y_nmgaICdF|Bo5zNr{B`3b?90|~S|yqu9s$NB4m=G^f`@jc5O@xLZr}jM^!)=| zXnz^DcJM&&K3*V(F^>EKeQ%ISq5m3SE!E#1kOx0~d*JUI1{WAXOrht*l2!SlX^F+5 zfumH1(F%plpT8+gHGO#WOoZzBlHbr|=DC{IXM|LQQ9!ZFSBXIbx|-orwetEQ65k7v z|8;r*l@mQscG1UZ>9|6Ycko5vQ|-mQIlT^8KsLph_nP4iaG~1%F4R@`mzSrsUx$YsryvLvO}=$F?z!;~Di+ z@dS=AhJ#;T7o6c4bO&q?lV9)YuDmv0Eiv&vdGdyK5Qhp`w{QKX?UFb&r6*;t^&uU-02gL*$s)9HkcXeq=I|pn=u<5@EI`_lbbt}l zXQjm$fGo08c+7xMuzI6~-i*CD$HRuPetk2)Bm$Ere??YcPv{;Ufaa2*a70R+FC{LG zZsUJPXG05!5{`G_gfALTHxxc2{N?BQF?1oq9XdWQe?}zh)GHRH_G`oH2dIa{hW{%x zKTN0=PlMh26ut>ExzWv!Ziil*LD$0a7bOC|^fYW@Zph3?z|rp#80wwOykhX{*2cx3 zAyw|;xy9FW#xRw|J}%4ggxd_#{4~bK{k_y{u*WOduqg?%GPEDC4ibSO6LW8G?*oS& zks2eOJ?)`8ny+ATg;=f{m_^j``u1Ok@h)Sk`CjQYjC-ochZ#u+H8edv{pNmp6sF$o zDbQIZp`%C_3Vdu@B1+=G40)%8!FR_Z;62K}FV=<%Ene#_3V#4sYv5jf-MH&1?bx4G ztmaQu@VqVXSXvq%Fq@2ilY-rUIy!-pe-3V`*8;-H5QSV7EE~gDNJ>|dzu%fD*Q~M7 zg1deHqDool3=ZFQB936DyE>zK+d?uCur6s`Q{ZmSe%C@31`a}5 z$T543`R{8i%@IgW3L?LfDT5_UFSoV`g`$VYM?WHU*Qd)g=cssiq%<(;-mjhF7$xhL z$woY3)mhr@X%nBmj_S!(-0Sf>9-jgYi^v_ij!)N)HBfe8@aBe3cu+B?+t<`5>7mm! zaGAe)Qv?0MfP)cX4UY}D-K307`l8lh+4~>X*a5R(n!WEF`-wg-E+nl~SBcN+Ljg)? zCAk6QLD16-W0(cS9r*dwiaZoneY>(~=-j82I&A;S)_+(=9c{*HsE3x9@$le>Sy78XSdY*X?|pCjg;>Ck2mi0hLm`Yh#94}YPf#cxe+w zn8Us1BkCgVb!bsrb zjE}S4coUlc(M5zGYPW}%BbMF`+)0rDaA5b@Z{`fbxt|>v$))K)vUhZujlrT?kea|k zo_gP@5wlcc7i17NpOQku0q|0pR<>5bf)g#(wkaE9XQCJ|BjYiusBSaU-5YjY$ynYm zSvIH+IUZO5JrY~l7nKKNlo}inzit>r!;q!7bWzQ6Hbj=>Zg?x)2E3KLYfbCH%F{Cy zcVsNglVdqId2j_SD>*G#bMmjPb2lCP<7NWQSunnGl}+q-)bi~{Le$ZPXUQyqLtMZM z+b#88HG~G6vvFMz1bQ#qAXi82(RNk@;4;}G8}c+@3B5H-(U=inqf)iB?mP7cja0op zQ+z|wPFzE_Z8i7pTkkX8ZRWuOO}LB<_HgIUe`u>UU9yDc z+hu%nJO5l7Z+kE6S>beSHD9Aq z@Ap?o(2Jy@Qm}+42=}kW8!Yu-)3A5yh5E~_s3{N(LU{h1lDo0GFTPk#I%N+T-Zp^f z6HqgQN1IEW~C*w8L3;=`luH^*Q_n9O(8$E;c!~gls#8o6egeOLxt6PtaCJ zjoMRHAKe};gG|i?{ zML4aon-D_z#F8PmNHIMM$QHf6&>COQcW*hbJk7<+L67k74JOY*%a^RzDzA>+v%2j# zQqIF$9o_3*B>XO~lRcZalw+f;$5Q<>U%~bu z+r7)F5k%|%B=T*;pm z`AErUjaj?Bj?us)v18XDl2qes?$Mb|YgeCa*#F~*TzlhLkCMFYrK;?QKV2tu2EZ2k zlidvGex)(9y{>GzIMY+ zqG!yWrf)tj(Q^>nzRuKC2Mf$i_;R{SWFIAKnkGgD8I;6~*o&$2OXo(x7|p*k^Vg`M zIv&__+Wf6T74bzq3huXABNdmlSWy>}sHM?JMD{HtLSOxuZjy$)Rw;j@w+<)FqJ~Nh zmdt^B4ClaAoHl&b3VV+4RvKsPYbr6p6+#SKvVsX$R#was!$t_59`)cmuz|H`ys`4$ z^G9Q(!`j0Tl1yttKuhXD$Tr8Xclv{IFZ@n6_%qTw-7KCtM=LabIB!{t-A%`N@Hl0M z-1y-F0sgrnRT7f&jqlA~e0TebPHVqyL#i1(viPFbj%1q5hNf>cgKhgOejV+o-)bi1 zY}L}GWjAf&=DG4PSYZw-im1W4xeB2xxb)~wJ@qc->ZpPy?Ow5qAT$l$Dmf(9Oc8L9 z0*GO9HiLIusCkm%H91=G-Zg`FwTV7h!f)=bpx;y`Wgiv3P0;Wbc?;w|jua%&C&x1O z9bM)=TeFgd*WQvl@BWf@u)n0l7{`EqAGEsvG8rLbE1OW$eG>?@<;q>~P*OB)J+WNO zro8xAA|dy=fn78%<{?^iLOpdaGOQu4+<0i=#yCYhm&*&*$GtipuVx5@r6kE;P^H1clUlCegd=zc9cR?R&%K$r(lOl07v^ zGfo<#L2=WyW!|=Ir2~5ex5&uE&n8c32D8Ds!_Zm?a(em1Q+N}X#i4-7-HOd!dOAAP zOFKjGTl%yxU7m$4iaV6P0xXi0*aP%UDsY z+xINq8vdWR8-;-2TrT?|22CXY{t4;bRBZck^x11Tr_#@F(=j@JUnnu1(y!nk9Mg+L zC}y1%5Wy_a9xvd#3k)XCc0g3|AZwK+I6ZKm)>_27M~YeI6?`F02BQ#kDiL%Y(C*pz zBpj)lj7ZSXL-EAQih5_ioEVO#h)py*!^zPzrLl@(>=O2n*=~=yU-pQ3#6U@;ZN|Ofoz(xldV#XyOgNhLRi8j8xReWP@Zsz7=KqO z7l!Vgmyz^bz_wm$=uxA1OZ=bYXs+Oj zI!GS9J>l$3-DgH?{Cfx;PUXK6PI(gK5iY!)6e9m-_i-q?0Tw?CcfKz3nGs5dHb_?%(K4!eDe01pJcuKBrGU=ZTHu(v6mQYv>uWlU zogumf3a$5_s!v`hAqg@^!Lzb?2{LHd+2lhKl;i`4UD(MXVT^P^AP?6)tqFTFnF>zd z>$-8HRUeKN?Z8JOvCg*?0<7zV5E71wZOnxc_4c*441874@%*Ss>Ht&OY zsy;p*=r<69Qa$tPJ)>EkbthPV3+C?$oZg|ri{1uv{CD2)Ur{Bpk!o=ckUR^B+i+xc zB7Uh}pAYK~avaTbncN)w2(O>9<;LDsv`DUEaa*Q|S#lfN9(GsF6SMPuL{g|J?0icN zuRhN{EyW{s``u+EJc98`r@F0N%yNv=HNeFswv)>K9nB30Nq_y&L-Y|l=GSJ_gqZe; z>@b<{-|OgM;JZLVBz8U_u?QRqj|4X9Ma9IBhcUl-mC(-#2mA^;%=jlZQ*7=KDSPl#6(>To(*MytH0$A zQ9C2sXm~LC3h}$XkK5;Rqug9?;(Nk2#8d7Sd@8~_o3{>9?JpNhritHz1*K>~k`zC_ zA^TB3)`|GG*cSvDaQnOeXvAkQnz*gvp+uI=T26=aH=GR?qMU2jxMS!toQw3px-r1 zXPx>UV||6*F1cwTLe>RYCj1z}AoaiQ%?nZ^e^!K)=Geh-?hh|zI$k(W~w z#g8O8_H+nZKdv4+)6VLl@!imKCRpE98q;iUS#k-`pN}#QG8;y|kmMeM>JMTH2xsOiZB5`!65b2?-1N<}< zpvR1VPRE&>hwCLo6AAuZggScJaqEtD7WJN`X7@qF<%SCZ$tGA|M;bP!9o+2GOPoky zR`rpr7OGC##aO>+vOKlVd4(JczpOzq3sa*{Gx!&Uzn-nNYBN~8OLTJ)tzZC*KRxpC z1;hxDpY_62264r&^y(LHpsIYu)XRm#!0WbwiJjPj+onw!$Nj%yiU%MgP}UQ#TeeIi z<=C32iK;r_cErZ!x1T*;E#E-^pr2S$^Iqc7xv}q%jF+@6wtlsGV<1;?Dij_L;C2%k zy&Hb1?`!?|vLr%`5ex!-s!GCm#ja0VL2JBm1Way8Z%l$R;HT2o3!GCb7ukzIVVV)4 zd;vO}gZ8{9t>Pg*RM<~48Isnr&9y(TPi}27=0eBB2FMHq>Zze^zGuU`K%?&rH2Mho zONeSFT7)j>7WDS2ozhLxl8ay_gAR?mjGhmmYbXm(17ZuY zN{g`Hmvvt))n?fE+X(# zg7lXh3M=dvD(HY1#BDHO=Gg~u^Sme_;qG^m!Y9)M8qGd$(&OO)dsm>9d;kS?Kk>jJ zR`JO}ieA+E?j>mz99SrIPd7c=Sbgm@fHiSbL7&`B4&3Phfzs$Z^3OTT2uiL`(UH6^ z*r`xsgQ`YrfblYgS|=4B+yjx6JaVOMmhNaU@j6}U{Z!>H#h9NA`u=Ri z)Uey$d3S(p#Ifx57Xum++K7O_MEJQv%O#opjP#`vO$WF#Jx2qFAr5d}nC_wx=)J_I zPoU+MhvYEDD)F6pU>*PrTV`hS2i*i?SDC-TrlmqUTfhH zN_JrOC!uM!UV3iK2w&ZFrfzA5hjG$hIQ08XYM$vMX;MmXTK&r8kPs!+{2a(>bB1lN)s$}TIZKy9Z^ci z>S^@89-7^Cy%wkzPJ+qN$ThLsonubvlF&= z@loU@*NKPRM(PY2@HJBUXwN^Ybj*_6^J2mnv+~HAf9`Kmc?$hL1s6zSI4yrd-CXNA z)W!9&BeJSuB;WamXjr5EjY{$;gw&ih8YBO&p%qZRIh^N0hl?$`jUn}#k7at_@9>il zN{RWA=@^tAo%nT+3^BBMZb~g-;TQ3Shs-l>Sq>VrjY>>&P}4|xP;Ey;^49;C;E&P! zI%if5!J1Mk*B6MIgBtY=fVwaUdk)>89}m$tLG-(#DB07_oQ^uFS5uq}c+8A9F)SLW zIm}1R+rmMb^@+C$dN}(YWDw44wg4Z~iFSUO2^;d^gdv5FAW)UWC}PxT*zO~cPN`{fd?JL`#CSUp zILaRTi1;vP=+;>^gXZjXZhBwjh;niIiz`1dk*#Ktm00kS1SO zKc;{h>y|Yn+N<%m0e1Zmqq0Lxn^mR$`u8;ios`!b=4N(TMzPOZp2z4M2*Mw!BKQnr zp3{>YvrkZjd1=yFp!xCqJnV}(_`ii@hp4(=)|ImI1qPtLS|iXdrR5-bo!!S=g$I>= z1>AUV6a90zFgzqY$<~|4w=%W{IZ~`K3`e^$* zpDYG$%`n_CAmt4N+noo=Sln)eOJ=Q;i*0f>K%ew(`G$HhG zpr>^jt@xyc>2>JAZ)x*N$K&$F!hnMI;Cc0>j!uK3ocoanyo2Xw<|(u*@f4CC(eg1{7@Xi)BYsHQM>ng-7r>|Xxu@p*f@{I4 zXdzi>x2wY+ec8t>DF5978J33+ohGBRBITJJJlyG|BuE*vBL$BC$NQIk`0U`Z=+C*e zX3y(B>er(V|24MW|EqP4sd;Ip!KG~kF%dv+G*9{gS)O==qxV|wQP%!BC;t2b-tA^H0IT}sd z%wEx|TeYKI7|9%sq2D&NAu_1XU(1NAl{oYGUL8!#^k~cIJme z-R(#uHW_EFi8j##p~in|I>q? z5K6^!B55_eRBt7BMQYMbv+=Qj%SF!Yb?IPr_f*fbBYrZupVW=aWDt^q_Y@^A7h32J zy5|>zeoq2Kh6kmp&wibL)T|SwprF~LuWM*{a~R{vWuKaAbsR&M5o0sO)^yu+%Co3l z7|2CF7#nb>c&{6$Sif{@8eKo!jtAhPp3+(aMwv*&K+3U%wx-`Kn*QtDmr#GQK|iOq zlmR2(TE-Jw2l$^f8f2{FOJ+w#ID8{`ooFt_GoMT? z*LfMA#DO+~*?vBy`yytBVlp^=_K%=H_;wD#f}>~l{Dy$h`o#o~D?qPF_4W0yz^rsv zx=K+@XQloiZrY?G+jsg+5ky@n$-#q2JudN^Oy_nHm>=?bQPg@`NQqfzj*|vAlDux* zXfh+~{bL{hxx>gx6QVH0*>i!6i_qB@M&H1O3+?|9HHv7XoI~eg)u|l5J9T1xgzHAx zZ(>H2+Y*DTCz&Bt&YjGMHp=~tdyJs~`#P2vKvzAm;@m+)fC9}Y3b99&ZcpiU{=h9p z;H^?a>r)3^2}I&aB@FfXLIT`Mf6qC7N-BmKlrn@#dLvUln?>J* z*=;gOYS41x?GlvJxZb_(IIDCMIUU5##uw}ixYGfN;LChe_<)@Muz->f&EjTZ*_ z$sk*ZnxQ`%fTc`&0t~<=eJF4bSJqNkpS@%LQFQF$HL)SZWG#=&h^(y1zX_oK1bKy1 z{0(q(`v88v(&J)-{ez_;4S{78C9b)eT!4%#WUfgK37{X#G%?z-?5N*ZpctKfed>T* zMGQ8rETPW@v>$Y?1+wX}#a6MoXII5mGdl^Rw2NQt;EF;4y|xMmF2a9m`6mBJb<%#} zDoIL_ka$C+O2AKO@OiGgammShzdo7Qa_=!5IuB-fba_?S zzt==zYm3cMHLoe}1P}aK$4rO?e*$Eix{>@V%*h49kz6#PfK)&+-<;Tch_+Ei%>{t1 zz@LvX9N?TX6(vKF>N_arXYa!3UbOv`^77b3!k^F7(!Z>H!0{GW)y>_jNacAJ7Oq%n zSssr#yGWB{6ypLs4^N_3aSbrJ{VF3M4!Y+rKlUCR!f1Bk;=A>o@05;3I5Ee;%FVmp zr@|xtg}|>7mqEWmLX1=xyd)9~aJwAgPzN$iR-K5*KL`U!0J`gw*K1rLhgjz*Y%=4H z9bR8N==+@z3OwfUK3nyAi2v`#agfqfv8P)9`+CYGS89X5jV4h8Vtvf<`i%Gv!Mke9 z$JLQ6#n@X}xjzdY7~2@B(m*wx3c5tyg`Jc0ub~^-v{e)j?Xgwuzv!ebn{{_jSS90U zqF%#6$3gxk1nNc&Qh*d+0C&BM+)30pRPD@QCgsbQZ(6v2kd~KU}3sES5Lm^mWN7D(~pFd zC|38j6M)?5mk!N6icPLxPETe0^L_`^BBq?o1fa64HLSi*p>Ns21j65T+qi+C6J&Qn zr6_mI#fRx+!AmT~tWkWw^XQ&m^4RDnFTHCq<2O*ndDkKwQ|zifYk}TS7dSTK`Z*IT zYl+B;O4?9}y8D^T=p<34Zi(V(Ht=plCh$!7wCh0OAn)qY+>?PUnPUm?K_Q#*$Klcq zc&b>o&re|4dW@{!IGxn_6X4qlA9U5Q4Lrcxcpx?GHZx}}F*scUAD;kNdA~QK7o{P9 zx+rZ;9CKjnN2QaDbHN!Bgq+y)R|ru>i z#sEqL=#OP@2j5-vXcf{+|D6n0Z4Gpg^!KZ{(}hQ}*ede`|F*U5SiO0vj_nMqQ9rhK zzlk+{=64 z4u|1L*X19Pxr5=vU3!^WA^`1f0N94V34??UnrnnX!0o?&YmlepI%csL;wYqB+z_ON zW(7aR-mq_C>Pk&v*FkcQFG}NQ-MTJ1k?9sJAb(o@*F+e6=ummKDoCy?d29Fax%jt| zV~y4In#3I>8vEhH2e=I`t+%^UL0*&0!bIYpMnT0{GEG0dlT?aRx6DT;Q|fVul^f5W zewae(;_rjT?yyhphi=#a-1jm3F9yKQ%uc&s*%08L2)Wf2zwaME6b}B617hPy)P? z>N|UlGxI6zHqF0*MtP|L#Ha6oTqRy|Pg`62z~N0i*FE??6P2f%_&Z&mZ;zPV7w|_A zFIj653k7E1{q*snr{VCBd1okEQp^qPk~)RuF(ZLI#o!PGtZhQ*FIZdZ^r|VCb#M#V zT~ta@aEXe!BNbN>uWE~ZKBUk)$`=%u|7;1jt`g8C+kE-@;beR^2(SDQwzB44k)djd zO&xEcs(hYo66qI|H2b~>V;=2Q?Jfsnv{3x{gimln6pf7t1GIkJ&HI@AyA8v~^2pKs z%>Auakrep6hBIB+c@zfibR3`gtQOrZ(_Zp?_06)OeR1QO8tK0hE|hv~_bYg@(xhy>w z*!G=%R|LWIz4ic=01|w!=a+w*NwtK(1KT(r6yT?ImLFx*{Jf6AN&6&&*>>G8dbI|Y zk0GIr^gU-ZUD?@9%*_}2oRpOeS9dQ29%`kl(96@B*Ry-#n@`SI+^BKdUyo~a*X=^WdIyC z(Uca&>3D%9MzUch9UtH10a6_%$0hc^zvRPIlMecMfU5MQM=LqmEqGGCxD;Oxr!U-V zTFMKgR(3r{-k?$;0QmdSah}qM+-x4Uhq|ALww#R3*W5LkPdmxD0X`V-w^=LhU(mkJ zG@9};VpSNcf^?U&8S|RcFz;Tc)YTMa({9ts@L@I*9jP!5Y+GLels_|*H?7IXYTmv6 z&Wf7S;R`OMK(~mxQ+}l~skp1m`@m|&+uJ^hFkxyHKNbBo#LLRc5sB^E&x3ve!rAFwg1G9OPoK2RTH-n0-(|GFj?BL^`&+O@ z}m zw_HZuZ-}GUsza;yLdNrbSuUZ+tuC6=#YXvdO4&>fUGFDwM*a6E^7abgziZ`h=rGp( zJK9cFnB3^wQ#jGvV~#1D{mfaql)1IdgKC)c=Hg10N;yT$NAquK58^)a+Zc>-%7opD zD(=#DUoW*2SWUh*SxhY}8y z8*>W1?M8L@O>@S*itH8?yBFopBI(drvOyesG+cuVqWIb!c=K=u5uZ>+=8;!pRv}VouyJHxbwM7@d{q^D>X3!md4Wphg))RJ{`tiQz ziQ%bQj;t^L_U)yVBzQh0D~r%wyy6+YO%-&F5K>KlkM@9Xe#y<~YcBBo+U(`&K)}@Q znU*p>;K$wOb4MtjWj3bcsu#Nyor|K9XU_Jgkg*EpwK9Khw--uP>|6 z_Y{+PGy*lEI{%VQLA=4C0r~Xqz|L>*A3R8kmyBFx=Kc8|?Jh&?M$#~sk8Q{#?Se7(LWu z*(zn@+NVq%+c~L$jaCPIo%DD$?~Ljq05Q)qmFHKD6krW1XtLeCFteZ7zl>N7dYe4k z?GACFpGh?TrD6!h1ug1oHg!>T*4@}VlyS$RrxkVQ6_A%vKMedfjQS%i&IoK`$Rq#D zf?cqAyu}gIrs7B($BT)Ti5mPL542iRt;z3AuBMor@W?jQfjO%J&DqsHN|S2-pG)3( z+1Z6Pu&#P?Y-odQjs1&!v~e z(@s>q)`QcwtBNyfCfCT!M_P1AH|Wlw8)at&!@ocA+qszP0DE!ahAHP3N+=gNEl#5* zk=CS0zL|Nnt}q9v`UNwHn0%@V<#~ADVNu;UyqyYIoMMd<$bEmWJEKA{rBi2JojBB8o{7h zVE5fm1P^)|3qPZ)uYg(P6Txm@+yBFhssf0?%ngEw&z_6rPD;iDu!OVSAN*rb%!^`H z%QQUE^BuSubzZR)hN>ySZ{WxI2{?M5RRUGVe(peUT!O-*v6a@}UN_Z;yjO+6mH7d# zOl7c>7SgGk`DUUyd>CgTWPdLgeRZPB6ISkT{5=|1{ti z@!m=W6$BpgZg=6AncbyqYpTzvO$Uk8nJ}I0&SN4^pFI-=i`DI&0J#JG;=NqgaVYit z{R5vD-zFxMvBnRI`>bPis2qXL(}5&nt+iK<6%j9mPTt!!80_NMMa?cwbLty~xW>3U zNj8-mE}SgEp<9eqlWa|=RN=w*^7Vl?Bcdb?PPx@72SoQ91`XUt70O`_+W5G3wjWYm zqBZAU4|Vp}u&J+Hx}x!~|GVaT@qN2Am2Kde?oP>U$cJTwk_X?Z+JhiUTp~@0xK7Xk z&gctbXTi$(C!ct!WRs3xtjWrb^!N3l@_ybY?EwYKd;xagmYSDB1bi2?$$64hH$Xo1 z&!1U?5&toSI$ zPI`;3O_yiAaRnar3l^)xmvCD2sWkPw`=yCE2aGZEUk9+q^Xw7ul~I-DR{v+}oh%XU z@pU^+BA={BULCW=U#Xk{_8|7U+Lt!qws99C2g(0mp$!rEYqyEng)al zTPz!JbYsyID8Cu-*t~@UBw^lo!P9AG4eXdUZ3$+Jb2e*@12-Ryg|8>@i-7h?t zV%B53Lqh}BWCVQbM_SmQbg_G&l(JO5{6mdOhv@eQ{N9cE60Ij=MWif&%wDmNRGXHq zYVY58DVyUh1~nBJq;&@9mR7loP%927_gxk9%ClqSGkf;!$%>mm_`OFM>D8fNFUiB*K|t5Q`D?APDsf_y1a+6VZl)*VSe{+v&ewNTftg*EmeF z^dCBQLaVsN>_OMp`wUw|-P1VZhiphRb00^i2@Hwt4B=QZ!ZkbvD;@Yn4YJ~FW=~1? zJNlH$-Vy(fkcwwzon7Pt@nBv_vXbY!dcH7!OK4JF+I zzRmvHS#G%9p10AXne`AYnf2pk6Q3d`{lavUaS7kh4K?Q%uT)7v+!qgmcW&{H6MEJo-bpa{BNp z8C&I2IP;9g!IEzgP5bT9cwEBTf$D41dD^k@BB4SBr%Zj|t&8!-oylr5L3IFec3)(6 zW}x(MptA8*QH0A?SaZ=(QY`2Gj?&;G91|tWl1ZG~amRhf$AERWHy-U?@4s=`2aWgzg~5)F2H^bDxk2XThT-+$OT&{V=$zM1?Nt zJ<03O4N(pyc!eAm1RM!l;~%F*h=~rof~>oQ>Na@*gnJUn06M$$9V5m#;|Af3Y=neh zI)WLTseZAtU?l@mmLUxvp6uRBV-~|e(e7>Wukb!|6}$k>+OiVuCr0i8(2mO3K-b~0vMcyE1vQc(U> zYXx&!oau1Rge^~7raf}9PA*yem3X3Uymy1Ws%0=(TV#kBf=3tp+qZC1(HlPJGUGVF zlbfCG;DrMreiN)!On}sC6gaLaY$pr-7*p2{jC_kYOXj?Ih^|?KF&55vn_ULK{_{b$ zsk;`@R*|?aqF;S8Z$f>l;t@_j}^xr!AP3AN+UM^H8bqBp`Bb@W! zSwlp{jU_&L_WNq_Y85(jFz{0hYqk-^2bc~h-Mil4khK0)U%a+fmCJ^<)AgOv5!!RQbWSz38mH@d7lGL>+&bXpo@R!x*K5y5(RlM zlQ4V(KUKLG132M21?SxgEj~{$^{*rVbp$|zl>-4}wv7b{DWj+SkXGS8<`p7XhP#vB zsd&6W6Uya8YjfWDkvHTj?$@?7lB-)Aeew{UmY!nE$ay|ubUESNjN5t7!!X9tmC^KkXrjgy9;ha`-dx2XLaPdLx_f_#rVu@0CULPrj!Io8k}6y3+1y2Iq+0@r2iFD6be)`WXJ~cYmd|vYW1IYay%A`vh<}c;) zeQsRI!b+iUu$0|)ws)}v8+}|nFH$~B;x`^``@kvZLsC-Gj}^W#I-7CViUPsd8SQ;n zWl%zQs&n9KT;I|`hhN9L4Y_Xj1iW!kr3DfLFi7AKfyQ)<(aSsy&7XC`rQPG{YbrnR)NZY|pg{AL z%SYA1c>=<^M8@Vum?{iooY8^^{}4WGX_vM5OTT-4KmdBq+4 zv+_&l*9QTgbwVEXeHyPps-@g(_jGf4>n;M0xEpyHS5NgLO$qrK7LYLyYrA;uYX-N3 zuDrQwlCmQ;T*go00qzDZ`joZBlplSiBaNbLp1U=MsS3Lux7UG<(`6zLaQk=YEZr^cCP%& zG*d4;A=P1$SXaAe8ODqJ%|~TRXa5cydicaXm=^TdiI|&mhCg`41vj>~yyJ7mYNO3uWG39KrINI+w5i*F@2A@D+5g`c&VDAr)((2c8X~?EDiPukpy8%RIP8n@Rf@? z59?B*EK{+6TbC*E2anWIbKwTJ_0dOVu(QeWTNfO3U@nH`HjDqDUv{NfiT}zsn8jW6 zQP+re7;si}_24`DVm@3^u*Ni>u6TyO?k0z8#7Jk9z6S<*2%4kT9GMKAai5U+SNO)reUCG?Kcu?W?C zuo(W^bLTBrTB?D+@6V?Y+nvX#s@p)@4o0|5DNJ5ZI2s?^~15p zn%8XAPrpY92@2MR+n2pYUtJ2OxwOFm!{8a~S96}r8cbc8H%NWOpn^-7yu$!AY5%wS zzsyW&FjDhJaDJ-1nAifud-$|+LI<;IjPQ3cRd=2G{GP79vF`Lk0YiL<)%hvMdthXF z`RU~2oHPL&HWDYi6;Yjc;JXcrDHZXM5?GtVd3+vgvlhC}-sDJKZ9KseWI~!fZAdr) zsHsD_{5aTG5XxV(0w1j@PexqgHuFwI4TNW-tiSGMlh2?9GH~w^*})D6y7C6roP$!9 zq&MW^>P&^61<@Tr{(y38mC0EsyyuqePqO#8=l4xzc%9;~7t7NG50Y5L)>-FnEZ zzOLowAmUpZHI7^1(oO+*{~4)!!g}=!8|c`|QOSx4_@JRKlRj6spZhd3b75VrPgN~1 z)o7OSplR@Hg`0fo8h*i=z_3!I{p3>k3m^3tLR7{kgm=ca1J%uRsRS=w0|BsnBRCQIeCv#UcQZc9C6$ukG zA~|og$rGR`>tF|Z?dKsr=@K-hpzO4I^Vbzk$4Tnw5hnZq z=YueK#6_c|xuebeU=WZB#!UTv5O;P>8Ca{DICDM7PlN#6P0<~WJ}$eD!|sEDX+fJQ z7BS8^H4EzR;>JUpB2yeeamWnhOPe)0V&(rv5<;mQ`squ2xT$jU$^8x;2 zxmN%rROA~rFc7=Iih1bN6du%19|Mu7=Ys~&00tT3 z9ClFck&8KVunzGPlWH)jG$0-g_0L-%{sdPivhVGEs63D{Xix~UEA*3rZPRhPKUwaJ zOV>FPfs`=V4i9z`)Gk-TLbJ4~8wmhN@!I!HtrZ0|+(H5zB*l33e>s;P{spW^n_{IB zkH5%^&>xyQ5-95I-nsl(A}#tUht%;)wyZ#Idy4g@ZUzSAi~!+J$80XLk6o!ABKj1v zPfZj#e&DbgtB-1a`^;riWrJ{&Ql7a<3{_+>Y0!a9g&Qg+n!4mwoz$?oY1Zxg}W=rt&Wy!KhNDp_qx@64#y zg0rr+h(wM>e&5FV`KzFMFmXA-A}nOSNp%$)<_jLY7X>KR=TV12c>q#--OD?vUtgcn1Ge%1QD3|6bZC!V+AKUcCPLTjgk-E$e!sGJDV8Vxh*|r-Ko>IfCsh z4g1oK`n!@oOvPei(?wAlCN%CJd>EJM8UL(ve_*Oga1`bz_c#k%j>vQ1dfQ?@!VZp% z5vNe|5&lQ&zXxE5{Gm^yb47oyj8v9%5KkZq--h>ogw}8G>tovi^g9ZCyRjNi@H96G zR6*?xsr`RAuF|BH7q*wDGDtF&c|grQk?Ja4XLw~ROdMSPOvj{|L_o;E)O=SGASu*l zE@dZwN^G#rhVaKSa$5g~v*BP3Nairr84t4n?h?hxH%rB*!VNxJO-1w0TENk@>&aU| z3H%>8e~m5q3kG_iAN$MzU@qoGSN^Dw*37`N{vp_516X3I1K=sHka1i~PIV1?=<}bd zYLA7BLBDdik6ZQFsILfr2r8AhRE`< znqG|}yZp(w&P}oC|J^5IWcfBVp#3;Xk#s;L{X#?!48He09I>`Uq zR|4hbKYe@u7Ahsa`QKf4&?eFva{+hSCZoOa%r!S&N@+i1cg3S0IPB$|Ru3k%8CkLz z34vC~Y=LO#tNWw(rx4bldS=gegw?*|sQ;p}II~3GlcvK=1n#0pzW2oXMC(lvj@-s~ zXO41w0LSxPA0bC4HFKZ|5caE ze>JQ>s?N*1_#dFxWUmx zQJp^@RZOG1703SXs82ZEJyj5nHxN(+!vr~{^u4KU+h-9;3Q=UQb3jk|+?{>7Y5qw0 zoQyg*I)&XUA^2*2SB2`XSn~g_)rSwYNB-`ChCCyLzI)--`;_l+GLJr0%-cSDUt{V{ zOU_@({z$;I$a(F)aXYJn&X5i&(|rb5FHM8CF<4STMO!$@zgiAr_rL9ooV`*|P^k6a zeeY~aCIfpL3ILy9Oaj<(*GtW{RIzXAruu-W=Ak^SgCvwGuM%$AUb3TK@?7LDa?Kx+ zaj3``I&K2|*V?en(DeKeue8A|om#@@2Pqq|3+1El%J}V`dv)6s^{pz%cJq_}hq?G8 zVf#F~hGAh)6z^~8$cfy00Nw(N>^1NzKoiK?WFDLcw6Af6E+fwi06iUF1S}pf#Z{8p z11tWYNvKCcXh?kJMtg@@B z7eb}@yN}S6*Z#kpKkGZK&Db3c`y=D{5_dN{N`}Q@{e4efJL~W^nT_<(j}Zfli6&pa zM8kUUbBXTvb0{@A)Zpiqo?=hD^8a2N4-xnDH9GckvT%AT*Cf$CVv?_7Al~gnRwby{OB{(=^gcSl2HDOC+Rk|LmD4V#7#qBDx8(GRW#0CWcwMB!cC;bHX0 zc?m??4}guUIDhHx=p&89-xQuNGJA|ns#HZvinO9aPs0g%KageztzkbOJmQn!0ExQn zcS2}*ZFQBj!2BP}Tp#r+_-zX~48ZjjKc6#&laOnx>VgHdm0=4y`P(pFB^eU4Od5V7 z)9QCz9WJAr=`LfFZ7u`UJTs2s-oxZE1E-F@hfVEOr|pO8U+C2;jdgS7DHMN;IKlZl z@A$L{oKb?U4VZ~Z9#_jo!KwxOmM?poIaLjqaS>RVAG&R=t&_o1n)1sMXHtgyOC23~ zdFYut-}!3S-XGF78ehQqJ+ayW;hP90DVW0KIC#Z-2GAGPNCw@83EzEa5rTqS^kHBk zLc+vbmzcu3Mt{UgWrdlU5Cs}w`SHu9+)Um+ z#=@>A3SVyiX}RjtOLw!`*CX^IRO9aJLkaAViVXNZj)S zs9Nw-s91w7_hQ<`;gabA4~1@Gup}gl$?6%YB0WbhX$**BqFwn(pd)~n0>5~+>7E@9 z@_2a$(&=5WV?xG;3Tq6)!twxz>fGurCvV-`i~XKMTLX)VZ~|tM`RMnqNGe1$^YU9o z*dHeT4v`%>iFjEhxs6jvkp^&sBl2S2K|mrcbNX4Mcg_0)BD-nVT2lt)Gcwj%qOuG zQDeJy*e9CQg&K^}pcZG~pD!zeZM{2SFOTST6Epwz!t2dPB%IYDh8_pQ9v;rtDnmd( zkZ}8}KcOJ-tg@`V2A}`~q{-^p&5`+AW)J#Rzg^+FMKFoZZxlC=Ml|7yP_DIml#fqa!o8}9jorCkaic@^27^b)o! zIwwf7HV9+atu$(C7RK|Ie_HO>1M~H!u*v%ct*2UYZ=Qbk6xs&oy=zTPPf7l(lU3G& zg^hhov$dg2#u+PXRq<`meUGEp--LZ%w%?09gb@NZ{8aFUb5m#f$6KEknen3SXmog= zgR__^&t}aIlDf#-^0)C}K_U|Eo%dRf4r-wqOrj8-P;mER$koiOyNunabI3mll#mw* z*oxU9FSI3L#L`#BZ4n26k(mxNvbxh;-;~{-GTGz4Z>{bsQid10V8MV)ERp=xwh|Mq zaQ?*h)f#Ny%F4IQ{i5>9_bwNAI_H5$$XG3IC2nujQDhottrYk*RSP;{TF^EKuum#^ zkb5E*h#YKuM;(5`Um03!u>H1x2$U#13H{ZiN&>sx^14R>bnH0i6q^5q36LYEPCXay zznyboF=k+9X6D?#vEWhC@sO*Z%U|kp8*U0^(>n{c8sI+p>@G5BO6E{7FR!fK zF^_Ms&i&iwM|=Z!l0E>7BgM%)ZYJ2%cX;uoZb!2&HGM6&ep6_^zv!A|>403#K{(dv zSH1ONKEkx>A$L5tG_-}Cc`Ta^cD`(!;3iR(LetrBUq^~=RdL&~MJM`~W)f8*Dlt(Zfxe>}?wJDkm3 zR|7pR4t7e8Q=)yLQHkl6Gyw_cs}Y@#XfW`}XWi9zz3Shxo~m~YeAp$fJK{>c45|jJ zXU4+7?In5y4WIS6Lw)SuYXyQ%!Q1!-(b$wkBL4!DDIV-UZ&e#rhx4pmT2|vJ0b!Hr zqsH_};L|}P=?9~|G@@%V#d{4(+NL{d?$$KMZCZr-=$7WE<{*`4FJa7=aR=~{z(<+%^h%|YII@LiC*AI}=-R#xEG(>}C2Qk9Q8anlS46r`*o^^! zM$L1Ax37!#RTi(~*Uog~JtQ>zh9%EOh;#!!E4Zx|mZlw)mS?DGeaF-n{=)I~!-rm8 zYF|D5&hyjMYg7UPAN<7i!3#aS!3zfn9&bQ9f&IWJ%-9<2R3Q&DEe?y*)h7d8D6k?3 z6*5iZ*m7lVuxcOIyg{|O4SvH+U^o+! z?^!|^4h1{*z zuj$sm#@7CYZlzH|`AHaH&GjA2nt7c=qyE%ACIqnbonk&U)A!1~jQD5VoB&54M zTOqe+8}r^ko;JbS-JtFcUs&qiC)-kOT#mx^2ntfWE)0+ZYC(lF%HMI{0b-k~L9(>Ji^&Xa8|I6@7<&W3BOR;!A6)(-3 zTX%merl%K6%fJ#`a&_$#2i@l*gDZdi)4|{&Py-YcQi`#$urRV0Ypr7Ni>s35qP~Br zLo*^cc(pm`Zi9>E8{qulC8jSn4l}-J60jzL5ijsLy>9lx(Z!v{$dOD3c^GM$Bgy;C zB3=nteG1U`VgY8ubg3RsM(&-ysQV#1R$uhF_%})TO|58<*r>toYgWufJ~FnDk`{bR z(ny3LGgYj2nWn^o`D3zGd#qQV8UzsP4_>5~8gPF;0G{fR&%Btm_c6Bi65$4%wFEn{ zgBQ<5$;s?4$LZK)VTj`Aj6FgRfo5%!`p3-dL3<7fn{N4H=NV)zx1JB+>z_hju#!Dn zof2-UJ4wM~&Q|h%8~6eF?_tCN?+deh4L9RF_u+oLU(H1Z<}%Vj68fSnvl&%axZjWn zU$^LPaEx!o$w@qPjfw5%I6mf;V&nhr&^!+B*wmD&J=%eC^Ealu$Gd6s5^yy&xz4ZD zFMv@{De$_AAgFO^k%ngSurG#z^Bp?(a(OwQ0Y@ZaDCY$qE%K*?Ak^3ubr)D*sw?Xp zwq~0{-s?f5%mH*`sI0)-<)OUdXX<2Eek)3=@o46Tk1}K`R~-g^JpLM@3kkQAwZV@< z3JNe8biHIS#luZ1`1YaFqtt=1X_vGQ#tCNQ?7Ko%i9x|wwAf{O(6*+V{>Bly2|UZ& zO}j!W9!m;nbc}GQ5Tbo6et)ssJT21Yir-QO>i!MOJL$t-y*X)PQEQ?n5;uQ+9T$**;s^6P`=T`Tr}@8n<%5KH?KeS!a)H%gDJ!-)7S`C>*|Rki=<@ zJeYHf1?OtT1u?oq{eVK@9T_vSLAmB-8mhHRIq-_zkPXM}YrHTja%8FhYQMimk2y** z@*V{rAM^4oO&tgo?~-C4VhSV58uswR-z4gVgs<$(>yuk)%c&4HizYeXh^wR8A0!u~|= zkrWBd{=hP0c=+T?G;VX;oRWUVwsVAw?HOt~@%P#;N8dc4-QG}qeccY*8VzorDY!$Tpt}qFuiSBVW5Ol0BD0fNsajmDjxvJwR$89u zk%mJb4|mqI?B#F}SW}^6C5Sg0w)9#*B}okNc)o#T1Vb5+c`VrirWN+T$;r_y)&(%S zoy~p9F>B+waI!SHl~(ML(bBMjg`@VQ_?lhX5(qei@7mn(5XZ9~vOkEJFrYBK)^wOE z#H>M0hV7@OZL0oE(Z^MK9YLFiSJ_0a^|4wXAJMOn*oO`2y$}tO2CW5C?LRRH^uS04 zAEp0&EDMgg#5Ng5D`z;nA@geQV3zJl(15?MxUb1{p0sqPe;>6Tbbq!#r9yC+@uNW*eA3 zF|(g-zptiNE5cNM4-`gy*&#k#RcF{{;2c}Yt>J;i%-{b#Bu%)i-qyFyiw;(Mac7*q zdW_$t-}0Uh13{?8r8F)B3)qo{F>6WD0vhtC8fZ%SnW1T_Py*R+7jInvQDxLNgtlKq z>h(O+JMeS4?vWJkZUZ>{!b}0i@cfQQQlEa6VpAIlBY!IqGzjzBmZgMWwENv285$Vz zG5rKNuyG|uk2tTN|;G^qrO#>1t}X zX_rcrDYGj*=#I+33;CEKmx>*z^GLL>6svQy%fprSrSKrKPCK79pCI@*6PbSk8OrBl zSZ%tZO0iH6YCSit=p6Z#J2)|2is+^I3@utN-C&eoNO`|ja|w*=&y zJ4ftC2KD;=n{f0axX3xwN(neO2<0ez5~4iwJlG&QxE=DOH@;ulb=57+?zrFN6m0398@)`s9; zr@erPu+o4j1~KlANRs44_@C5ffU+C`!ZYd?Qh%YCpBJO9Ua5Ny!$b%wb`kuD?b-NF z;85v7y_Uk*S5m*m{FbOhC``~R;S?7ETSp(?UwU#)gNLxkhWgntg^v-UQP35EiQ(=# z5D*eZ8F6ieE!eciVk;&MMjqxhb=Wip$M~`?# zqsOlibBi4T68^~AGTWH!Z;9HB@-P83M8Av^YyG)%>85k(B{zCUj*0cM??nh-FO4yV z-=NsjS_ngG&*wM}f`E+tO^E=4ganlt+3|eoU}p76F58W7qcsiKC@H>@se5q;n-0_+ zNOAAr`LP;zn(Z;gao)#N;@mMK6{H{(dwihw#mSSn&?1ZIV{w1x$oE-m_n{)U*HIik z=ArZlj8qL%D10dn40?c0Ij^>l$hqa=T9Rcz0olvXul-8F*QG!or5_Ld|Lr*BMc-VM zsDCfRZc~Z4_tvkPvXr#|pb|@Glp{j)TgiZ8TAFwE5VdIf5`B1CTc}WbTibAMyuRs^ zsfmf8rNz}h4H&Y?wvH{xxP6l6f$da(Og~VNlQjATb?vLpSF6ecKY#apFVa!}hS?S^ zrozd#6*wa*#+aPxM%6(qMB)kRZzg)A4IaWoQ;r-L_)A6e=#se26nAud9vtRKTckM6 z1nl0+4B5{U(4;_L{t13gWM$BC`!QpyG_ z{(dD%*O3VAD|{FZn_AH<88WmETk6BG7$JV$CW-O2-zW50=NI%YyUa# zErf6pLih;1nh+f6kufhEc|T0O`p5sr_km{0+;m8FP)DJt<)3Kjd=-{Jn}S_2d3%mOPBs4m=pH-ZVh}RSKS_S&zn((b z8UBL1DDidrr7g``&&$C<_O+s zc|_SZ4+)PIv4u+*bGy`8hE*6zSWr-qbAXXgP<_b<+As#>>PN?md&lz;XYNpp2Ari( zil1{DhK0Z=3wOQ`78)9Q#KOd0N{c{osM*1C2!?v{8{;mS4k*7_F>ilEk|^Ur$PTcc)9!SKj#i(T z=&R^r+n=)esur#8v(7TxzvK2nCh`2K>B*K;c)uT)q?lv?28}Jny%BQThOZ+F zbrZbiUtKjrSS_Al9Y_@6+39|<`w(xAQ0Xa)x7sbZRO!I$_?88Wp8HcM`d;k_XL?ap zM$vk{c!>jwA(v(K%xhza<5inuxp7LK!>5p4+U@@xquyGhPJJe&*^c|sd^N}JLb`hw zgPIy98Hj9(z}d9Q{(Ude@&U5Jp?t8pJ?PlBe1O_&@TPu-)ZspCE2Jk(B}t0U>P-;$ zVbl~AW2*Bf^Pw64q#yco6*|j7j11eHl=dDXP~$mUJG&nAbKeoyk{mj`d1^~@ifVUM z=suRHved~ARf0{P%aQ@BE%LW4bT8g

b?Fdr`|zrko!?uo>v%qnHsU%<*UWk1YzPLCEM2j z%)TFAA3h2;?bNQ3E5k$>p>69QRWH|5sY^L@h?l9AVywii^r65$8i)G+%r`!@L=O@= zFexFrqtxG_W@-n~H8ZDDI?5$8LyxmWNy)YGB|0-_{Lq{)ty65d_1Z4S?s=# zby3d!?Pbz!x_n7Bjx_CVpUTUse&M6%GSgWZ=qAQ)qYBfVWi^$LeS=X|MxCk69*x`E zIZqc(MqEI`;dWBAa0&J1`*^ePFBCpM=Zl*w>Kbrs#fJWL{T79Q;CA3I@Dalchzy<}~jH-L=@A z>5%+m1xoC&{YeP;ma888SW?Ni0RuPP(-0_`2)CQJ>~S=+*n<6fG{m)pe}Ejw`4+!>y-27Odre8gcwZbIz7L#TSvL8j%z<}EYK z$cZmv5U#)a64m4!h;GS*xYIHlTBUI40U741ls)*^?M@W=hZnE8Fe}LVbJpt*1}pG$ z>aIaF)gCcg8V(Ph(QXBM(90?- zJ!8{}O~PXagstHs*M@iX`EL*YJEO|&A!dx}!m>^Oe0QBgy$r&K$8n&D*4CgyYO=j% zGIKACT*6OzvP01w=eE-rQy!%Ig-=`)MPFeiAFDfQB_1dHnYeMEgMWT&;b&ZdwQ6Y4j&&eq@%^_(Z2h&pg4mZ? zf8#6}76i2v=0n|(* zzvGv&-$CreOsz7xC=0A}+|D0S<_UF6K*)G#xr;@(rFDE}q@QRUft8M$0YGRsqpq= z70@U%bz!%|D*NB@=j7O>DBFc%iN*W2F+$77A|+R)J#+sW$Mw>>1ogXswZODr$7(dr zc{_@a*up}_!{OA>dw1K<^!_tt(m!1Pob|1KE$6HEXp5>Z-`!t?CDGViUuJMF`Q%>H zbS%v_Whc6(L~?qPUH61+iC4(I7_s^U11rE(OwvJ1oGk3>NPxVnR>=juui`U(-}_o# z5QbUXHD5XxZyokyE-_8fge5T{!AhEt8Ck|x<$RjIOIp(uC=G1t$ek*7D|&9c*%4CK z<7X=j#p?{Nhif-BPRZX@WMQgESUO3eDZ=Sv4Ojq3Dz`aZb!}q-KH`qyaz~)t#qOy2 zqfMZIgD`QPlZWB$Rm?q}>SC!XNKLP2N#<7JUf+(MHc05WoVE(?i4)_EqQ)@3pj3H- z2E7N=gNxwUf(R3d^u04Uj0{TE6p}xs3;~3ad?}9ZB>X}{4qT%%+$_I-OZ)u=A`fZH zjbf;9q?mC1iO>6Ujfz?+WDs@nZsH3LvixoSfL_B7%AljCPbh*KNe0z;pGW~99;p0Cf`5+9W?P+~Ld=)}U zQKWI4;%0joJZ!2EVrENS_=z%Lw zh|Qg#k9RDzpI-Nm=t*QWZ>VpnjX!4F=mq3^qAUq^axEVjJx;s?dOGX1PnbZ(-Q>*4)mN2nE^r?q;w9Xk|SP_Xg$ z6@*kiJH1Vep4z0Ftc3fVr{nk=nup}zDl^eeX;_$*A#a=!bM%H)0cD!hod4MdUq|4* z08BS4EI8u)wXPP8(i_pyL3a^mBoQuD>>~*@W2mMW%-u~bR)6NXs;GXV=@lM9ae!~5 zF2oA8@!bplsn%GWQU}Wigf8*1aF(ywA~lF# zLKfkB*1A&0VqeMa7fQkgzq3dx)xLCg(G!+apf$WwTUy>Mc#1Wer-lMSR~#^tAjx4N zgIFDDp05{4IyNL#9S+afGp)XFyj=PqzaT@f?043X`E#YkYJ;?4gLMBo9DE&)dNT=L zdkA0j{ifh3aO#HrzgM-1TyCATW$V~ZM2y#G=g}Vvq4xdZ`}UgaKCAbjyTYF+&lo^7 zUcG6|<|o=GpL_HwgSd0b=yDpP%iAj0-QO}YeTk(;%-wJOoE=pe0Z&y2ZX)s42c(7|+0>n(twlrWH8fll{~LNXD4 ziD*j6Kt(djh*Z$P6IpA*eKQ#Uc#+>v`@(wS8f!f*mcctA=3|FN&*p(@?-vUK*vB8q zFQbSX#)EJy8S{v#YuP&-2UbgviOgH%A705k12k zd5dBX{|kx$$#$V_jClVv_(nY^j~va1y)wNoA8kPrP^c5TsCsuA{6;UcY3Mp(l*5c^ zm|S^C!i>^zaq((^QDW$3f<52OQsUP52Rf6Zh{_Bm1}FB{MRl3M+Mkt^$jIE&jkF_C zo9qL9_W(|dlg^&7n%0>4;=H@`>~nEjsl!vh4Y$nStt8e$Vc3U>-P)pjnsQOHPf}V1~2v#wq@^riC%rB>L~keDSD$g+#xa3c>Fyot=eA` ziNCQUkt4$TqkT6U(`bqFj4+k;tdg!VOCq_({_g9QjYYekG2g4KM*UUUpaC1@K1R~o zK^VC5O+09r5+1kz1GqR`Uo8N`3h{Xu1pFBSjQ<@fWW)5Z@Oq2%PHb)6pXy{}n;X_{ z+fww?8XOIZ`LJmi(_<0*{Y%3$@`FMaCX?!U@+E#nZ-bM}Pgr3!_?fWB3~83mg3$&7 z=i=stZDCX@Xp;c}t9JsPuIj3Q9~(j77NAHRdOdB)E8Ykp&~PSaLVB}3Jl%O|2^86K z(y)f;Fi=mdyjSGKV6X^CshnG5+@s61VHW1I_8P*VOsb?Zb)m4eh<;vnJpFN@m7chx z;AsV|r>(p8e%w?yX-QwvN0qVsL{jKTWw^n2iET&QRYluLMcdN?t;>R`>EV*h;gZGS z5{}bP!^-5B7-83msP=e68JfOxvcBw8RB~^depUz%+q4cy@+$g1m+FWc2+v-dJ(p1%?#JuJn6v(byoJ>QMQ(P~xLaosK{rX(Yg$jnYz#=(Uz zciCNq%oKl`ud)C4yflY~Q=+kL2gyqa$BYH!sHy2jq5XVt}7Fj?eD|E464> zVglyo-m=z!ox&Sfz;}3cWQ1Mprm3cezHBc>9HHCD7tLPFRGJ*0j){{y)tIc}D@p(e zEVoH(o7duP%Q^__gMp(=1UMQ`a}vx?D>cm}?HPFZrCDCvO*(SjSe(4MvkwBTYH$zo zQx!Nu33@E}w6OOr1{P~cEWF*K0?>NgZ zS^GGMMXq0>k7;jn?7c|I+iWD5VqA2ZI0yN;e<4}8`PDJ4a=wbvDyQNOU5kVLpxUf$ zt(sRO?@FFt#%%lX)E5mYk1=qph^A9k^W^P{cE|-GkN8=%#ysx~KsOAb zN+PHJF0NzZ5d-fU2TDXd`$}vm#mT)G^UKei0z7F(bP@6{x;IS{l-=4}h80ww{P^Wq z!ULDZQI?cmc@i-%qlMr-!lt7qF;?v&2Y)UYwWH7fH!wG*N>Jxua%mCdt(CDllBiQt zQ|tQ*dgKt|A(nvP=;kjP=`--`hituhW!=#u1Pia)3|_RdeF)s9P8*C_wCd=V6!4es zYA6Y~9qq{C{e?K`CtO#&1;OXs~s1OWlXX5=|8p4hD?91Xxi)}a<`$M0V=+a-Vl@SY8n z9vW*JfD2&E@31!fR<|o(jEn1oyU3eX($;NifW07fi4ny^De5EC+A1f$b9WYDo^Z&lN1IQ}KI9ltA?{lBi}aWA z7tD5;P>O%m!FMPSYb(_uLU41RPi#Xk(ka4vpNJ|bx~ywW86F|*^bb9Rqv^Zo53#WN zb8-9q)4eGn01SDJe758s@OSl36ppvN(E%xW0j-F)iS|v*e9=e>KkA%hE#{Cv&B(L8 z8yQ|A*JK;0=_)0V~6`%vRX9ir#pV&n5;`iOK5Q`{Nqw>^GN}Fp6#fd|D!#tmJ(EECP)a+%6 z#F2$nP#cH8)1Q23UK07u$9z&#nzY#$Ix^UNgLXDJHP#8$SU+KhFzRQi#Su&!BQkf$cSqkxpO)zAnW<>7ZL)>;B0W{v9LE+C@9WbBZD4x7SPs#(tr2*J5qh{O zVm|J^&Y_cT-=5q@J;THTOwKC*1- zD7?BxEl{Sy@K+*~WKS#cwk_xS^~-KLp>&Vga%BIOKz{J;0zd1$d>hD@_F3!V7giR0 zZ@ja%G{bg})8{E7+GkW4og(+Mj)iJB_YU!vt^BB8I{L%tNA3%L5iTK-qkiYdvTl6%ivOY_C7sT8RU+Qww9WrpGei%gHle=@?Hcjn zD*N}G@=2z|45x`KcK&h7veGRPlL4ZcQThpuOw}DFVW^>#S0C%X_w#~!C*K!2E9HS- z-G^;|)L(9eS9*NDEV=3D2}=`y>z;LW1ol+mn;vi_)v>t!=eylqbWk$|mFUj9SlDKj#D1vDHbCXR_toi@4V( zJ^8d`uZFFl;>@}ydZH5Fr1>tg)V^0r#C5QAM;1XNr&2OFH+N;1DtB}iIF zPkGb}MLC%K@odg~8sdD-2t>DkZe5bIE}J*3p&YtaI{bUo*>uprV5T%|@dmQP zv~POYFGHE1Bc>;r#U}`w&5@oD(F1`dI)0niy=(9znu&xp4X!p{yN|2y#LUnhFu2CZ zFx@I#)f%eGVzco3b~ObSuX~F;dF>w-kMbol6w6H*uK1;&bd34kUPO^jd}DzavS}#I z52k{VSZwze)+Gt~=}OXi>voy~oq?ZJg}6Q*hisBgTKxz}J5K%^!s@^2In=FiecZD5 z#339E246iZV=MKKPxboM{)F${o2nnRx#|p|;I#5Ms&Yg8VRKJzC4WbgMZY8W;LD5? zlVmL2EY*tlD;dV4Ho8Tr#Szw|AKh(@pW3MabMm6MlWdk$@a$ziXO%UYZF8jN%X)wM zta!?q9EQAdYo3;gS&R3Wlk<5V&DKoYQMGGy zCyhRKUyY5pzDGx>*BIZkZ^=hDQen-)8jgOkM4jHMP@DB+ zM^t0jqgP^>rHK2!bK1J^ozCp#RF!&E6X50j^~SjCgtRhz4*n>5PUofj=Xnm=n<__h zAKppDuEjjx&p(V`eU0J1k|>@jbPq3xr7&%hbf*!`niBW{MlbvcZKV2iY;B?4_S2H5 zu%zGS46^Lyiqu2>?yI;MasJDAbcHZltmf%Spw;wZrl%UC*?UoH#y8Yi2?xtWM=l*M zcP}t0##kHf`}6dpM{c*?eq0qGY2&+nN%Wo9;lz#N&>EpKamf$aQ#J7uA&@|HHD0cX z(<_P)qomh2O|7&8^#r)zkJ%HY9NvbB{|NQ&2wD6$V&p5#J!J#4<8adTzGK?T-dl6! zWc4nCF1=18{fT09t(hDPWN`PP?MJzSul1X@?{8n)Vx|(XP#m4xKs;L`%QEbQruAjc z{5?CNlj+Vb?F(o{K`0G$iRR9!v#?c5`xlrYiRHz@Ut%%-!1m+8r`-X9m=7_G?}%E= zBV*AZr!?>u+_-(UFp$GjRmSzQKARBH;JpWMzeK*3d)MFq|HQrW^R?K&&8s=4H1ela zXw$@*jE;+mWgH6Xk_Q;m=N&KKd66xG=H})wx~Xojvc!CzE54OnXer}X@a+9MQfY)S zML@_%?9`=$gk_APE~!y<{1kNJuDSfyD`O|~;~?2~E+ZmQ)QzlO`SYRoz@nK8zcjEB z*MW$aVMsjEiYW3uHrY?y^IA(E?XzObmr69HU+o#KbQ%JS#5lcH#&<3{^aA_Z^&s3$lBL)NtTqUfmrZ)Jna74f5KmC59f>!E6nG=uvcQ zc6q*S3V&8dGd)jjQ95zK-GHO|$)<$k-FzaHv;A! z5o?aiI5SF(fv5Uv6HRiIUby#(Ax7Cs*3DV>^fu-Qg?8yi0Tn*@hNd6BU;NU7yq1XM zI1mgc&t3|iHIkjkba<3y8}_DIJ1s%iZy#Tpw`kg1{ckN7&L$qvP5*^RjQ*^4H!}9c zEdCsPdoFfP{CB1qu6yIAZ6TAj?QUacHJRafMR^JLd3137X4(5RRIpktGDvroNbYTb zNmu>HKWuEr`?#K>AM8gPlE!~Pbfh$BU3{E4Yrq3Su^9A5CKV|qCik2mWN(vSmo$uX z`Q;m1k^H~m+Z3g-RDYjB7f^fDQZD*G2XxK=V)69X?#2{0WP8;OGj1z zzqc_QehHzV7itF?Pt02!A%PPpgt1et9aEe&N5!V?g>?26oz0Zy&?r4Vf%zLtTNtjJ zZWQ^>^Mr0XB+NqivL#fTdl)l4Vt~=_ik_}H=?$~EV7lk7df1_;N@JyD3+DN_!G)(P z_F}1s;EC3-iZkQrtP6iI7}<_DGsvj%p(7CaeLNlD3b3OGyo?93J#fiu=c*u;CyDLt zcwCpTTPVI-iR;e$KTX3kk7gJh^!ZpeM*-bHTx1?cGQ5 z2^P83MlI6+ijEInSPh2o-=8rve3TflgbP-;#rD6sH##~u4?XkFX)t@WU(iJA6mfxB zTwmF2(lf{FBg+M*v3B{X+Ih~bm6eOlSV1_Ap2aoZ7JRyIQB=$jtx2|#DEf8dj$2L# z^{I4?Tr`(`+n=nNPiTh>+r!LAWt3obnC|cP+Mug?{}w%E8FZ5EHQRtF~J z+H^nFBk9Tmw#Zr;dF3bdGq1V{3O~we`Ju-yhSP|4{PI~MfA`t-h$9??jM1EjwM`3? zkz_E~ML%+{8oGEr{a#q&gEN)k{3-w7?++kg62yIpsjF}#DEvncc>@kTm(!zGk_{X2 zX1HqbrikQ?0+3gM-TRLvc8Jy;x81IQ(I8&a+PiROHDm0xo8OQnB~ zjFlsYHtro5WscIKs?gerU?v25lv2;(|48nA(U6*nQn}*Wa?kr68Jru)aL~N_#CiVT zU|V6(X}7>f9=1}&*u!Ub8Uh-CbeyN-1G}35b#Wkj;r-K> z$mA-X0ZKHbMUdXY+1dDJyIZc=1DarGANY^W9WD{aVy*An<2sS}v3u&6ejsM#$iki= zV6d1-iCvZ-`H|mZ){CZS2?LQ5t*aB3Aqoq3ZOgj>%M3=ABhRKSddznvXeG5b-=J@2 zG<#f?sXVSe$p{+RqdHZ8$|Nd8c2X;+2WG*@Se-oab&?wKC<<_?u$81@zQ3HR*m-lP zUYoZ_SdlIfs15Z(k8GS8IOqXO-5v+t)l{wzSn0DH2T@cW)svhx)hgd3qsUQ`u z3SWqsb{&iVYG`_;VObMLiR zT-SH$ovrL*E~j94eugfg(V9pG%?F56$*8YNRA9F%1_PMLA@ZMrqoGK;TLbtU)1hlk z=5E-J0%zAmEzK46%bS~p2TRLKOUP%H)#cNQ;@945(#a0aKu5ZJrH<4(c=MMw-v;%b zWk)MLJWEvQE}ise=;u(_Shcs^{t~}kAhG^GBlPHOO{f(QD-vw z?H@KvRQ7KIKi_NR=selwMx6>N5uoZBM<+IZFmxISo<)&1~~GWA&&)BmJ|>M>nA&$V_Iruzkrl-5?v#nSJDPbq5J#2Ea^lM1Wl&4@CM zx0X*^{p&wsAHX;~@e4g>ZS6E;40wU8SSGT{RNYZbWeja}oRdSg=E^sLpS77m4&U@Y ztITib%^tKUvhx^o_OrZR9gR}>>h+TVCVVI{uz-2np0JmtF<^wwC2f$Iq~eqf+8Xxt ziwoTT!E%JkM8mZDN0ohJbq^EaGTsU25~f7ylw>!@!rxdEpb__i{ZVDSf&(MBm%WnQr|G5yB zMm=t&pLHhW?=d(eZ^m(2F-vY}Ha!M7JS z<8BGOO%I;m)_WnHM>-}>cfT!U-}-i1{lVw(d#T+;s@_mrb5(JrtMXx&hMIj8`YuQ+ z_~|>MW0kW3B~F76Ts`9E3uQJ(!YI@R`C$2K+}L3?8fCa65IarshegDET3c=e$dAQ}Bhu(lGJV;I{NM*EYW{?^^dk+4?9V^OXHJ zl;!ADZ8p`0P&pkSWlm2~-RGVlU%_o=d&NtK~gB+QZBfagyV{QKGh_BGu*pPqS z$sOS8`THQ^{nvDW{S;W-OGG~h^dsc94?Zk&s0OxlFB_}--|Jm5W$^upA2Bx1mf`&q z<@BqY^c*uJ1re}8FY(NTK>XKOhEm#-As46fX zs+F+HxZ@6Dt+LKX6gzvAPyZ`0{#)?Hqi3b;z;Lv!g=!TO*{RN1#<`^e&k2RK2sB0A zoAc!q{#@WNiL5lJZ1`U1T|TO%SLlzNaBuW(nAbP*A3>7;B-nNcM8lATUHpU{d~e9f zq>pqHc+xAX+Y08v0?_0{#1URplgmGq8`0>~89Rj}ZOkyEfw=g<6jJ`;l z4SUSMb$IqCWL69w-|?4=4+2C~J&oi~cet_B7MZINS|IL#812@vFa`g0yp?aH2Yltyh*QqC#NPaEAh zZ_Tu{=9@8Ert>9YUsjzhzmIpf3wz1ZzlAnPiP77WI5^~(rF2lAiGrlz9iZlzyEHYXNXq=XKeKza4reIQOra1 zkmdtrGX!%y8<~P{R}Od-WBbh`Kmq|Mu7WX?VSh1YF6v+RgIvFbSmHfO0z+ov$xxnN zD5_kBgYLjcR4)s&cb%YQUHFLZ1OMk_d0HZebKlbfxMyiFFSweNNiDJ9;q0uY-%AO!upVUyqMuBISsb6P1X z;?WLdJt(sqGo^S+(< z8HE6Y&VQ43?OBFq*23}dE6O%IWcAJ{V|$q;hTpoIhod@bYA$It0hY^kvfyy7%L=7; zqrm2JBS+_N1g&4is(!p^@HlW0>Ik7%2dq!8%skfT&{ZjajmBAfYU);A0IMR1{x!IF zTib%VQhh2t{+q+@#~-FABO`Mg4@i)A#=V=R@X{RE-mojH(km@o_e|bK=6L0O>rA_x zbg;8)NA6JCN?4tp?X4b9VJdNYCNGHCHv3HjjSaPk97MKtbbupYf;d29Wz*09kbdGQ zuBR^?`W$h*LH)a|`pdFczN)1gBKyW1!J&=LhDN4h&$X}cS0Y(`q8VFN>$=9#+R&!r z<24giSZZ?AC5hC<(Cb~Yfpm|sR}*Hq1HCOcD{UMHWnbLB7)-G&<)Odjjc-L>z@$xw z6cnPY^0TIQ+*^3?3m4+QD*kPlb--%4%m@db3|Ya_w2oy8YV)bL{DlRjU-?~{<^3B?j?jaw+hUD&)${plOQaniUt-87iDLt zlX_NKFc^g+sb+H(0(>*>qNtt@Xnv=>3 z-173Dy?of(c6i`FrQXpIM@;jdNv7@rG7ZU51G1T{bW8cGdLP|Gcp#c6tUyvw^@}a3 zH}NA229h0QG%s)L9SOm@qdyxp`yr41dh$^QoR!77(r+FWsfW=83oq*lW?T##K!0@a z=SO388I=auquBJg8$Vz$Z!cl7RLH5BA0~<|*^UxZ75e};eeLo#I>vT>^THTC3kuwo zhnqiC#KggB<<*~R-@iPklvhL&?IYKWP75vpE7_trCMUkwW{@HErF)`G26XN!Fg|ph zrJ-wK#aXVCeHU^2evcn6j!zVD6cySj~KcR0hul1c}mcf(|mNHk>*)Q<~3D;^dTF*6t#gTR%ef>-)MytczZfkHZS4L2$`)^0c+Yke_Sdy;{*Xb{%9`K3o%iOY*u?@r(B9pzLcY%GoIqck^TX!!r6m zX6L?Gp~A=al4sniTs~3iMR_|2B;rpYZU*eqXm46BT*U^Jmadb;8$Tw3(#3EAmZ%=u zOIr36sNQ$0xEFsDVSf^DV4YO&d9edo0}r0U)WVn+FbUY}E?!=0OkO_V*T)?Omwf>c z7^6yc`(+d9%pag3J1@s^PTSZIZGQqjxxBDuazG&v#wH&F<=iFB@+-^3`-p)f0d1<> z&gVCDaHb}pOXgoJnU5z<=|j9RYhaEo#;@l;LBap52=!Kr$GCUSK)LAp(ZgXe`^g5V zG>obOuYkHE(D^~@S7eVNp^IGZ^{uUmr1O?`v`F0 z;LA2_pXfT;V;5cD%R~_rIj0!-YS$|MFJTx_eJ#yAMN5V}?B^r5+ggg~cYtfBpO~tv z&5ircOShqEUU4-2-B&iTuib*BQ%vR4Z+GlaUK*lg9HwSJ%@9pXF zCi&eA1h@9DPY#&l&h8p{3Ut$doLKvd?VertQg(F98|I`;-8Fha4$N~s^O*B$6M<%S zGwVuzeiX?{1b2LP%=>jQUV4|={m3m9g<^vw0>sp*?_YL4K|SZ^WztmH%jrHj=cK^0 zl1jix5`I!Zr#fqzt$lrv%JYBb+6;{95lRguB_$_j?4hBd2pZc$_zM^x>Wvk?e`KA7 zynk1N-DTo&>iR?$h;}KYpAQr;pIU81sbeftehSyQR5}|}7unG4voGg;R^@KRWWj&Y zT0UPp-0-(q%dujbgK7G*E|qKl$fBv5R!*8KeARrhI6n6WtCc+<-x>Y&;B{pZS9Z9Q zdEM7{N(ioF{2ei}#TkrKM*fDM+v2t=PYpK;*=z$7ac{y9J>cyVB6Zpn)0O3A_?%+l zf#J*GGw-aCtQk8cE${nJy|4b#4SpV0NBUS`kfc-TqD!&&EO`y%J`Z-UgweQn*L;nZ zWas8Bv^c^+vcaXw8bq*hD*%f~N~6yhFs{~;y2YEZ$nHbWeMt(`^%uiwd?d5poN1z5 zjG=fSfqwHSL#DlrfTaUFmT$&aBb-2!gZy+t%-c%NV#C|5jqfW_le;$b@(1(ELIhJ& z{g!9xQ!WKvL#-UW&L==UHT2FS=upqB*&Z4vD99&S< zg zHry3E?U@{%h6bv~Ph+UxZ_WcRa`cg1CME7W3JMCp>k|@-_oFj2iHiynpX5Ot94`0u z!)d99(^J~Ut+}FswqswCzWWhgTuhbyn9Gkq|9T$*vl^miLssL!V0vF7h3Ob1`{qrd zGPNPxGgkJU=Jt}4V9>C=pB3=d*Q_KI;~chir~xI&i|2z{yy8o@r{pC`Y6m8ubCOi*UH;9-4AwjPsfR)f%c_ih;B`bhD@X*udWvgwp{t7N@bX~iGSC33temb)T}6F z;H*rcza@mzTV+`3Z_74rRbmDw+VC)9VUA-ogZI@l;HPqPSn&zNUv5;JmWzZx21$#; z)l+anu1X_d4=FJ5tG=kRi58@beG7A}am{-k=)xHbwYPX6GFDS`f)ORvFQvsjtU!Kz z?org1sv*OYUjgsZ-4y!!m?4By^(_wg+qs}d=k!T#(o5CooM zR%TbpzoQY63E^K{@Tei`dA8E)w!>6dU8BdYbbOuFq6KB%D9>1|>tspTn7Xfq?xqXJ z_aKa1%d-JqLVO4G1l9l4?*-c0SGb~=Sw(qcS!#%*AK)5#*8YHPCl7*=gWk4p+pDT$ zul-dIL>36V*rj}{`Bz9HIz56vsZ&az+Mq4WC(}w&3o1x+*OLuFbtXH$H~BaAOxDe= zn4T#gi-)y=7B5i@ zr_P+*yfc<#&#AHOh7GI>!F3I)&L%yUSS+59-4f9KR692`{^yrRq383D;|wI4gArlh zh-PSE;rtSYwi3OYwwjp$ZJtc~RWtd1Mj2Us7j`zf0sb-)X)=AGv0Q_TA}0RK$ylE& zYLo#&8j)A+$!yvm_;xbW0qvsN>1_8O=igkk{%VY{ztMOZqS@%I!H5cTQ!O4Z|HF^MhKfnt#g?W71b0rLpfvX z43PzJKl?FN2v-J=tA(!5B|Kgy9p#Pv@Egk`c@E2}&NfTl1+*I0j;~fJse{Yb$2aQY z?^`6$TI6Jv642@Y3m)}v6jrg%R?>`lwZx=;6#h2n6HM5)j)1Y}EaE!NP)B~cdjr4n zN%;pt5%aJ{1>T4}xFZA*-RH2Tc=vxz*zh(rh3hGxSkx-=ArFi!qPQ0{kWnqk<+2xK ziY9h`0zD9qOXc54+8MW;V&lxy@O}eGDMss*vHvhvPTSzIOWXJ0x8Nigdai@L zBq!g69^>5)RhYxN$NQh__d@cT!(0q%xhkEvuCzIPEM6{Y?^gmAisIVu@e4lu&&Q?F z_zlBj(u>v5{Oe<)i~I;vrikNmsH#qge@_R+!iTBXW+ikilca&iWmU6m^ zoFhlIPm>4BK&CoD%Zsh8ORk=KQtr($sl*ipa+6kvc(aufdI_J?4)^I>RysN_{OIEGyTt=l_GXVpVdf zermZJSU!x0S>D$`%O`#vlJhzA1528n(YNxfUK23*&|kJlhTb@`gstZO%4q>oNiR|Sdze`_*k?QS%_YVM-pLXw zh+6mzw|24LJ{ap73fEGV|6;XOKHX37<*l3^?>B5paTH9P9*OVKVlk*`bG4ZJx_&8( z;7JP}2t)Gp+~C=M_ynlvzoL(Lv{OjaZ4a+#vSJG7*?*H`P?Ey3YzTWVuKhe@O~L4$ zJcSXUnLLDeI0aVSb@b#y;PptvnftMW(%TL1-l)D7dXGNl@kVc~kFV$6f>QY%M=Sjm z0j>Hj(HHUMrn>-x8&0-xP9g;|!|YjGRE>vB2x&Ph8}*!?vWGD{NrcR!A5ExuuT-Rf zS07pnW>1-uj$q=)L@^z{gE8LO+QF#tqS}yVknwKvj`HhSk=AwTnP*H|ds64xpYFV~ zgc=!cMtW?6Fm-?Z2e?O0f6wR@*5lA3-44W@Vh^df$^IQE-i6N4j`Y{U!IA1cs%v;q zs)`b}0mtl#0K1>8IppY;;3ov%#wornX60YyIP?{N7WSj{e)5?5b}aj9ENXWSExTaG zF$bm`q!*TwlJa9K?z7$@TSi}t+xt4ytsC?NuL!2rh6guE8ueMI2UPKtt@{IXd{a<) z9k~_uKQyVdZu)&s?5seg0u!G23+)k%9tS46E3G<8RatW-c}aiEtL+g&XGu0LT-jv{ z^|c>Lgv#I>m39tk8TwlBh-RV_J*vd(r1t=1+TWCtlEua4SU2iZ9muc57AiTO+k|!! z06IcWlFswlN8llI>yB6OFg4vo(`|kI`t=PA`Z^Y&)w(dJv>GGa0o$!X^|f<~@F?bc z=w23mO>xd|8vdI|FLBnK7As)RWhOPln~l}CaNDZ`r}dgajcdOccYZpcX16V<=P4YTa1ertc3PicdwZlgz{+!usgA!{#EnYEsl? zB-k;uVS-q@7D<6Xk2Wu~Rtfv+j}fSlj&$`pMakXW)~pR1vDJ+O*=RJRLsPD!iqO&a zOFP;U8rjqBy{YI_+P#}{TD8Ji3_lx$FK z;n|C}D18gKlLq7w0b;7aV~b<8eC3$4QJGO}f73`N?v02MI8loEr`KY+GsW-TmN7a* zp^Lx~+Zn)LzG|UZ`A>;C2e1RMclF*YVS_^I;@uytY62xT8aciqNNx#YVO~>WLLlFK z=r(^5ut<)B|LRlY4rXVYKge=^DJ5r3|EHUXR-?O9$W({{;Dahss z1$p(ho5xAznNDgAgFDMWfjVvbla)n}i$EA7Y%FSV2n_-;=ZtmENlcml6*iG_X*z<_ z^n>N3FZfkpC)gXvE0d0vtYM=zY@-kdNr6Ol03^}js1P{T-&s_8@n83EQ5fhc*UZ#r zaI(zpz$~e<`t9Y|qjMW4x#mW9;;KAcuboQB4GBoxA%9d)SX8MtH)%zssntakNB?jq zdUph|Ta@B7fF@TYBlP|3qnF>%@B?T4M6?q?UM6geR##$xsFdd7!q0TER)`+!+yV0p z$mtUZDhlv*fnw+zHqk5|PaXVL2f3A7q@eQ7Z7>h0&W=l%cK5A;A1T&%3Cvf{1%t9e z=3k%`))`V+PRf&=L{u51-b$(+eJo80C3HB4OBO&BU@iH?`%$F9dQ(4r#7)x5FvStH z_$D#9Udg;tCjq_5n{tq-^dtSQSh`i1eXASneAW?SH?UafNW8>pgci9NP)VY}A)J97 zOWl4PNgRRHG=5N9^p&PysW#(nN7@RqDQwOu2KTirL~(*=HbRb)M3n-5juI?QM&4~& z$pd5KkyIOW;8^?A4Vqv&o>p*uFz9>&l7OVzxI{*P_(RncxC5qTs^CGlwG>0K`W!$D zdr^d8vAoUya9m9#n4AI+n9dKhv=IS4WRb?Pnx{ZC4_J~#*N z?J;Ugn&|RoWt8g3pmr43S++iWNB@U0T9{uxI~*#miKx7j`-{h$0EeU1H%eXX@>x3MzeN2;CByvAzB8$mp*zE9B$fpQjqF z)jWU+(tIS>`t2B!_u962!Rpe6#tr$H(UCWsQcaFo2V#psQ4#%s3Hg>kneUtK_|tWh zjb}}Zo7i}RZutud%EhbDKWon;=;T^G#yt+~ar*rW@^1&~D5LaSn-(^3L;+|XCJn+p zFsEociJP0(ICgCw)pee&1BdHYIz#{Lv3OkhO8o_`Q)##(697%buSSef;Q9kaS;!J- z=JP^DoT+xSK357b_;CZvi^d9ulg_7``&rGnG@F4uXj!A&o&r1v`dkAfNj9g_K<#4^ z`-IsXCF8urE}#-z!hN)2HcYjB?gw^WNVCnaie`jgF(-^XpB?Mtf8HVpc}O9&BnI=; zW5tRK=RufP=qVdN*ey|GtGR6R72PalvfY;#gXrh>ifV#?RwfD-9MnGlMW;<2r=8K~ zfu-6bO#+J9^uaogabJO!&%;<>s6&S1ZiQOY)Xp4UAy4mVJyp9{zJLGA8b;@5_*&_o zPO3e5@Cj;i*56XJ0Y5RPR84+(mvc%Nn|zy3uv)GVmb!nVWqPB?R(ZlqEmF0s5JOcq z;MALCrC=#5?%0}R^E ztDtWVx#`S8tBwHf;?M7n6vtVJ!n;*YV9S8SGxhEECU*E+(&yk?i#cp%$*W9-I7|qD z@Ow8@6Z_SGDR9;;DpCIL%()8QL2avI;yR$gpyA&ij+eNBu8!kKO%+5LsN&?kQs7WG^seN6S^9kg@6KhA1lhK*ug* zy{#iVvzTgx4Is4G63Dad-l2O_$=H}Hwi6*p1!lNei724)A zN|+!+G!6P0RsmvnL0W!<4aFLx7yxGEu5@oa*)u5bak0xG*_ay`LJkUv|I74qI=Vpb zt2p5^NNN>t*D=GuEAQMYsv1@5o_xW%8BA1)PHrXJw7Btw_p?0 z7wkMjc?dPUCTS&TZ0Y=dV1Q1Px7ZRTk%2W;j&8Zk2*sx4sl=4&UQ(Dx7TqjV6V>_Y zPBTqxz)5tEpL+D8@M}cFAKl@d;0mV2)*4I(|>m3A1 zVj}keC*25m7`PfFrD!RorK|s~=}4;(*9@$4O{jQ8yGtru%75{0H9`3xs8%N!PJf#} z;R)#V;mR@N>BLxc;HR%M{x?Bk({f)5;4iq%@h^T`a8P*hSFIAXu-ui$E}iU|0==*a zo;rd?B|{G;)VJSjBACqkxrfwH#!YOi(G&VRr&~A&QltBjsnve~7@Y6e?rCa;Lm@tu zLw!b|w;hLP_=NK)tBy7{#N_1c=qvIlzlHu*ERZ(`?7Ux+Ox7Ama-o6hkQG;utM&XnfR=QLMc6I=QkQ`NryP!CZ<= z_N@(Ra@j7kEvk(@5RblCmSNgEZSHS>s$L^|M~rBU10|z=KZPTz(mlzsS|y9k)#$XG zr4cT4jYd7km<|5?ZA_`MfcX}ZyQ%eakYu?M&$6XdhP|rM~=4@_=Fd4ewIHhXsH{SRRhQX)wHMx zhm`B2in8mZ)PS0lUnkb6G=S}Pzuy7M?Y?Pg?4<^)wdsTP+sO|HEpokly6_q%mZFf0 zZ48yDTEF$#?pM%=jiUV^>O_h`BwQ3GX4yI^-jCCY>HJ{P6cS`HK#|p@(s)gMzI@`&Xvj;M;_S0cJ7!>+BEs~FIMgq-T=*zpJDw;TLKDRq|A~qYqf*JGcFzDyk^iNLX&SGV> zF29$EBth2(#fQYJN^XjFHhqFLP_b`>b&>rkOmZknlJ&d=x;g5P9J}ishgRo&Mw0)@ zFO9y0G|P#eNvc#FG~*ql>(KalyDND;w^Q<#;cE%y!Oq07+Zb@><6YVF$ZR9=pm`%& ztu6j-YoEAo|^^W=^zNC}O)r8tePge?M=TrVe?*K|Thb{m> z4)l{ccy-Boa5@j%1X|7#VGR1%vLo|2_1L5@o35l)h+&Ntf2W1Fr!VY3+blM8aE`sAeHF>TDpqSoSFb_V@c2r+LPRnogJBA<}AX z--$z>xuqgsaeJJ_=`$|!{=jkwWu`6PwX}`4<`V1An<%a+BFO0Ft|mw|E4K_Yg;D>> zebkw`6?_yCojQy%u-zo=%TsRWor;XXNxPK_8xUS)!@t~vuI%Upi-F6alJwWxUgSSn!z zea3$&f#u7bYn-zVWi>_Q@R;_9cF&DGRHH1~W#j4dKRH z&^*nb-<@54@ELf8YaBR}Q>c^@a@LGaXdq#-H0+3w@%wE@1xmLkH()*=l;}Crk-CguGch;m6DYdN5IZ#u-$Zaj&mF^Nhf1T8STws_D9M@hipZ31X%)X@ zS<;_`pzMxC;XXX#Uo}KEBow90H*+JeLv%KsK`by{M(|jxb z@e2L=5<~rG63tyZv^S#x)s6JZzfaR=T84|fD(t8Uf_KNQUP=8oNx)3~(%h4&UOmDD z-oXd#^6R4&j&}RomR+C;qG!9O1 zcSE8MbmRwi8&H@4QNVYHUiaSUTo9uCX|5}cNTX*Jj4_4M%Vj?*No*UJ%ZoQd{rZFT zx`Hu(W1ei=k`Mh#TCk(D*Pp$^Rk1Q+-51h3wixgKBq5}nF%4vg%W47{9g&f$v*>O| zo;&l<^Y8Et*?RNp*3WT>OXscozSp0Ku!#>?KPqj!ulg6KPNW4hAmp(UIF9;$g z=k6%YM$SGiS2%X2^uuy`gmV9X-ZbRc@_*I70mlIXN%IjIUez-Fb$8;kDPqr7Y|C5D zV#U8?q09hCaeo+~H4}?cINE=Kx_kT#gO2;i596^ETJ%!K?!gTNOg~8O=Cg^?+i?(t zLRsF4d+^;hVe?g8BdpW}0L$2HifGnT50_qC&VTJf={4;cxu`uK|ye}JYEx9@8WnD4a9vL zsW~zOK3zGaMBv|Nc@s{XLFKB?<~-Mks-1a$p|#zOZg#vOLB1&|dc-^SVXYx({fs=F z=lcoO%6DeDe9f3lsTdRC*ekT`loYMPM{+zL>}G~^YR4f9>=D;~Fg3AW;ODPvGR$7- zR~ZBE=LeD@l3QnVsbnf^uLfpebfedTfF0zxqKnM#vI4G%WW3^gX#) zE?-__Ob)9F|h6nb@tv$Dg1P;*3eC=*IJalVK|YcLQR3c>2nM<2UZ|Pb60{iRn?jAe>Om z^5(q=(wU{KYu!3VN!`Sn?d3u$pf52)g7CUZZ9hqFMW5VpgAMz|0#ho_IwBGEHT??*h%q@;w& zoI+W)dWq+;w|iP)dr4qTKWM6N-dNf&C0m{u{NVm3mKIXOt?!)abA) z=Yi(RXNy@4JcRPUIuXr>mTHjqb8Qr76CmNjk@{b>QDm9mcXbk1y7;*xu*~a$BzLT0 z1(5O=dhC#m+c+mEqb(G`jJ%b-SXXePa=J@enyCZ+r{f?VO)uxt|0#XpRq^F9>+}yA z-9q%Y70k=9O$K_xwO@w*4_ElhA@kOYgA1+_ssCEffM68qZA__ws0iyybb>GP{wsO1 zRpTHvyE^6x=;y^?ESBJQxv9K}p(xG9K`Es!f+thEM+e^da&-98!=kw6yH?u>kUgIy z`fB&L7T%MO55zHy5ydV=Ds9q|Ay{SeCDsd~<(v!Hv-tuX3Q97Zk&u-{Bx!pUC|F7Z zaS04^CF-UKZk;61!emK6Qg}l@XI2N9(7>E@qnunkz;c&ePk;ZtAxIPmb!^o<6T~GZ z!ftL~Q|1@xVA(E=EIwqXN=lp^sjW0Og{gC$sPja#3?j%)_K3(-)NjDAwz_K-cA>r} zV3js2KokRj2>vGb$;-Yq5pl4r7-(uqajFnk`5>5AtQGL_)y@%_xZh`SS0${h{fCtg z!B)|VuhGHfN(n61FT?JN3M19qzwq@LR|H=veS``sLy5BJ`GqV_gO-1+HXM22OOFHT zD6wg?#x@_3oskAmF%Zk5Q=5_bQoqyWCr)T)PEL+=fXb_fLKzPQ$k-b&?50|pDPxN# zi&t&y84AOT=hSe0Sz^NMMoJ_{GX=vun&!iU3HdwaOhG*^r6}Qo-qnN7Rv;@Nc`Z($ z;pZ`AqjO9g$O=GwQi7KPnJpA$wma(#gn)3S*~mL&)Q&X7$m~FvEx)QEL?&n71ly## zYm7H)TFzJ(n%MBZV$sZnw`0o3e2Dkd^Cf;_epoo#0ZuAafk#tA5Hs+&&orq$|F$X_ zfcB68^)NJ4pgz4o$?Ms`8h)K>6V)tR}*OYwt^bjOH#v6&{XCkLAp$OJanN z3M6|cQIWtH?%x4!Y=NM&bNm9^!2Ddx_gt!^?7e7)iRHW$+KvZeIHuH&0;T)u^ftqRQMO|x=zfvAXI%9g0JCi`w zNc3h9ey1?+Mjuy2*8Lk3oYHK8*opTSJ@?u}YoGKATjs-3_e2FD)Se+Lx&Q@Mp3R#v z8XK@a@4Q;@2Sk`nsP>i6GhiP`uKwB6pFRXJC$`66(92?MRvaTF`k_g@PqgDl`wTVY)IQI^RU zf#=|L3tXI*RqGG1rh^*;{?aC`)a~zbZ~~>CDCLt6l(l^I*NR1#82DwCd!Pa*w>mDI zmUnH_Y(H1f%1Zc-JZ6cT%h=4FnPlz9+)ds3XTT9elm>H?)4o<-)Xd!>vcB%{m4il! z#@EpcqyKvjV@3|7zw=|Iz_kLHudBSvQbqg&F(sxFP+K_`{xH&uo$~-eQ*NIDs zL5t9obih8*s4%A|V40(S!g5z=3I}T{J*OJaeP0bM=i*L?Muvh>|2fPPOQojq_h2_O zCqR(_U<>{fW;vB~Y{>J~JzE?>fN7DTtqplLO zuJyB58`cLP+>X*+STe=j4*mv>&Q7HR-u-ph>8j`C;c5y43wey?Sf`Q1bErJrdZOPN z&3Xa0G89Ed>W2B=GagAHK|pk|$N@n1{C6r)l4)CaALi#UgMalcGXZ-=d{II2>7#oo zPxMQKR}H`tP0!@pm>%l`^)q1k34M0Xhf~<=1h)<*w@ia6?(d;0%ATU|D4&qEqp zTlFw&KYv{3mW?;bw@qG&(FC)J-?E?mL0`*1E60g)%rt#Y1l2nqDxqiVQR)!-#yOKf zmV^0aZA(EpS@evn#{=!SPh`ERgdy9v}yWSmv9#sKGuuI zZ>z2C6LcXIM6yXs&dD{J_%dx?zZs?5xD>zXZB5f)*`b$U{am1l6D?&k|DAdmjB~gJ zAvI1~YbzX+DWz!jbp7AM+I6Ws`+W}bN_Lp%_r`VRXEK%GoqS1%J+CtRD*ZQ0vNpa$ z9%+7|-nFhr&3n*Cu`G(D)ziI6W-*3M3*)*!{}Mj@!qRa~Uxdx;6!C^=FSgd&VH3o# z6I}7nfTKgbv{@vgBt`FQ^WaYIg+)`61N3?!e7st+-+*A3M@=W;<1Z@+_(=s1-*LV> z62vr%2RW@v6Xdb<&)G{^y@0nX=X9JQFS?m=pt%dIY$LD{LNCYs1cDH|;D#lR=;kCt zU(;w?+{TcBUq#fLB45cHB*@iF7B|nEn`NCXXu=7|dRFVyK!8sbbidi(F3Smub7LLN z#P;hhL=`^R7Z|-9M(V1(8eoQ}_(I;gD%QF^2Q--e=PcK`zY$u!)}B^wMgzc9$5HQ^T6n%$?tRve0_^v}zs^g|V43M?MJ zUhV0ny-JI=tAl*}1g)6$^!!vMd4RT{yURI|=JXD47g^wSltl2H147eVS}DIT15IxV zELR}oaP~nb7O>`hJzaiheLfc7)lpAlg{a?qpt9kux`Odp7vr+k;`!oP2cGJ@Vj>j| zatOH%Upa?f^OMRsv#!`CUF0o5#t6@K9d}`{(1Dky2>u>x6QQfZ9~s*9e~(2?jVB3a z;$pTg|2XE=8tH??;`Bv%8)$U=qrApe{jd-wFiB-HhN zbnv>-rF;f}GS<|+B%F=lRs3(-M``6A7DiCM=Ff_+r(*XD#cUaeZ%$!fTU4fxJ*FX0 zOi{k5@hBHVtI65sHN9&11WawYt{Mz_<>)lCDG2jxJrA0FTJ4;?72HXg*-Pfw+!`X4 zy)k!L0?jI1R)oe`a~1ada>ZyKQvs0p(CH&bShFUUQl{Ah8r%>LnH$`OHIXBsi&G+g z#k4^-2gK@9^JCvPpN3)i(TW;_=GZ<6d;z4d1#_%RyL^mB*jJqR>eoFDQO4|tYa{6Y z1@wPgeB|XcDHWLY1_$F?gUHS}Eq)pomSm0aDaGh6ONKZqB6_|3y-q(gP@=Skqo2I% z4^7cc9PV1pFJ;octbzZ_U7e?1U3A%zg77zs_tX>aAAaul;C^J5JLw9?_k=(rnk0~b zQy4uLs6r)&kyrJUj?LG$eJ*2FzFZce{()p(elxGe#%*?9@1J^rEiQ{l=m%gm5^ zNI?uA%xZ=Vw!`i7I{u%KhwlOAQK4jjlcsl1V zjW?X!t_1t*Hz%upo*>;V#fMQqN)G0pa;Z>`v`}3l=hQ1mzpfQBzd$3}epe^)*z` z;ad?~JW^=d?`vvx<~C(|iPA05P)l!tEVX0ds*`UjnRyq=RIQ7l@(00^mEpW&IGa#4 z18c|=V>QK|3?7pQ23+SC%7xDh{IPcBavU4QBA2o;*;H4PeSV111v$aZGT0^+tH?8J zrBMP@=3A3X5tw9x4!`Qm`hgz;$St!GL9w+jr3tEG*wNI`5bF$FZ`^W*+JdyXk`21t zu#VNd2kM)Ha)*k>6WD5j$cY*4NTd8Sq3!a=(}2ujoQ$AY`n1Sbx-v`(P2cA(GD+0>tz^c`JWTH+CN}}=ERbW(M8)4nk|khy`kFTJxRD+ zq6)+v*YnZ{ljUm;N{Y=Nyjbtooe!G{t)Wrm@cHz_j(_Bwb3{^1yD{%!Ub&OxE_`E{ zg*gq5`q`dVm_U}N69ZPl_k20No-Bp z2xQ9m(-}%biNQQ2sZNdy7>wNIA(dF#~%d=0tFV4ltP$%7-dQ9 znb?0}NmL8sy@Lc^y1WS7v@AOmVg`8JUQr^?L{rws9447nvbg3H zCMYBt6EL{k9R78P7NFO}xH?r#MmCTK^~;M5TpIFa&%L(Nc`_GPo`<=w0PoGvC1zu~ z0cv-TaZr{l_|7DjIAEJURlJ4tLY$<$aQc!B?Zwq+hynO*Z4iJg=FnqYXk79dr; zff1lZjAXi6v4Ifq=Vo^!5KH*PCj=??mSpXhY_xPf`Ne#?E7V+hOO9`5$eOOWYXc~_ z9gt}PqV{tFes2F-cO_GOy&^ENB5*~?GTKHF-~(nW3uYgcV0uWY@~jYaXkv_WHlR;^ zRDAC{lG`G(5wVku;o?SkgB4T$fP0LEerB%HXnTUEVvuh4N1K-h3{30t4CuD7+zTA- zL`jtTR`Ui5)6KnQWU z4s#SVk8-6x<~-xLzJ+aS_erLRIfWXbzFIRxoH|$2r12^`LAp&(l^4%Wea&Z3xpgfy zU#HM{QFuw2J|k4JVO3j8UY>eb$ohyZP>vJmMX?E9|JiyyuE&mq>LqX*Ks9C+9iSGr z4pNmm)rgx__M4(SrZoh^M2eu?(W`ue&?Kf@A6QEcAa9Z^(`r@Fnjsz)r=}r zo_?FXgmNgHf(FZZj|pdM6L(3?<2v(m0Q(FoYJ; zWS}d-$A#2a-4j_C6BrptG!1gC6pWC1x2zyt#xYOQy9}1W`ii3^A)Q@T$g$ig+EqqV zyGZfnt|okVgxTi8olcVB?WQS=u8LL%D|51ZM@ptbI1*iPmwBE} za{OL@a?#YvfpL=KD_=C){dj&UV{&PIj|?p zE0|r;SMQv=uoQ1fkNCQmf9SaGg+iu8Hm<<}=p$L@7$85+KcQqbou6bl`}PH>k3)+= zE+5)q(}DaAE$*w(C1XIOAVo&H8a;wAPVia4E$;I4&yjAX>B>WE&g{rTg%v5|^2e-? z6ZkLN0o#@=bkjoO)2Qpz(S^@%?Vy+RO}}nMCd^FQ>dwG8=$fnF{s*JcJ-L(kthB!g z?#F2W>|G_>0*T_hey+$eK?yPatQ^}lho5kP=|IHDA6Y^9g99zvE%FzN zS^JG?RcRMr3aWXHn5}#U512p_O;|NsEn3enIKq0tOO2uqZ0R8S$HiE;o8*v@Y`_D} zW#m|wz6g_+hcIyn!$>nu1S#{?itcymncB?WnSS=Axqd`x_(5&pvMzIIwxXnCQ=&o_ zYr=0HX|>WKZkAo#T}o{yUIoLS2y7OqKw6Ba*@^nr2H$b6{f*>wv$4Q9Zv4}TEk7N0 zbpXiaS`9FfiY(E1Zt3j)DYSA$Kff^>f5st1@%xKMgf^gIE4QH(1yUnD&$3tFb2l2d#Na!gO zf&H@jtpxYk?9yqjhXF^}D|9<{c9|pga}$$~KZ>A|z9v$k=n1YDVPTHYdyJyVjg5++CBTfUXFUk=NDH!OLD^y=iw$Sg!4UT z1ZuPG)O!IT@C(r4sPqjLgyDUw$tC!*);ByF@)4e&$#dw4@xAvAx}<#9CzMdP_R7I& z^gS6d;v?UU;g)HzcFH~T9Cjvf5sE$qICpc-!^pyz7sv|Au2(_-I>1ew4p%L-tL*B- z&++e)Vo}rqV%_8$r8a0W$@WTYDQl03tWk~c%st*u75VWa=eXZLhRzq3MT}4uo`3); z5C_#0ahA^>KH(IRZK0!rD$@Nm>oS4^MdD#cFI4V!Qh=4AS9ak4dQdD=YuQ(_A9!7E zfAH-iM18tDPCb^4K5b0|k_g`K@H3}vs7zJ|Z0B#}M)cKgOj9(R>dPwcQPEANht+>@ z4e9^78dmkK$FI1967cC#T;Ik``>mH?yKayaLpCuzmkCSWbRsF-#=|a7_NVkkOyz zVk6V@BjTacPHeuR2Rxvj@7g@YXg{XI#>;WkixK3{oeiXo01=s!W#jnFXT|x}lwC#s zfNMJ&<^(pl_u;0T!c)cIsy>7HlG9zZlqcf2@4L)5mMlt>xRg|VJmtT`?AS-D<@Vjp zIKs-~w0un*G>pa8E;``mg!x56wc%pj=S4?q5Py46 zwiQ*8MzH&EUAWTCZ+!={Q;c(Zr2r;8Tf8o$mporMS5NStT6xrVhbNCSctvXX25cw2 z+Zx!XJHtXVE?W&fHKIG{6e4-Q+|g%Bk<>BRZvS{6?Ty}~pPj9uGa zoDY~;-m-pSc^%g==Ql_u4HGDTON1%4UTV0X!b@d}dEDVJeY}5kEU;e^0JT zq;dZBSUd%qN0**#@{C#UhweNP{_aFFgTY|{He{*cJO#6O==}=CxAgDK0wKgEh|C>` zUI&BBPRgk2*QLEgM!V z>4WQ+!ye^d;}J1QAIkK_iqYw?;B)~7MEQV=xrxJAWU-eW>~ z^7^tb1~Z^s;t6w~#3xr>xdlfi`AQl@YB3r3-5(8(N2eTUA2`DG_sXW^7|NIT#-0Q? z(8gYV7;_%i%|1|?x0l7uV$yE71cq_`<=n=jA4-bzV0Bp?aNVwi@7c6krXBIN+I^W6 z5y?$eNPl96NInv!*#9=hbp|C{X^5K6IH=}?1gOj>XOIAVMx@J5U=9}p7 z=tYn|>a|DAwMue(FcW)?N$P7}4I_{VF;{q6#9V6RnEG92yk)QG+X&c1KR7}*H}E}u z$Y%`ro8^A_HuM{;^n(dJYFH%%zXBYM_bDe*%0;7aPNrJs<-cgn?^44N{?Q37Hqg4h zfSF3Lt=G(gyk?D7Z|FO?H;DeVkQyFhqtnuDrNPSYn@j$rKDrffpX&goI@+^KMdL`Cxsjv-wyOKrSDPp*?!@U zLJYss*tLolN8>2Dx%6LrkNBQo-4hx4#QWEPmxKJwH}U4M3|rdwBk7+IM)fi^eruC9 zPw-yUv&b56SsIVt+}!*lC;Y4Oeg+-r04Lf4|Erb_orDGRqww~|CUpJ7Cfc9a^G|Ot z_X+7}eCR5NrAlnQq&tE7t;rp>!3JLrZz&_BKpOEoz2IWdp@#MYp(-?CFh%e}B8_?^ zQX{lttWEUJKadW#Z}w(fDQVW*wlOI>PvM^SLfSuB#OK7GE-2mef^y>$^*01-w6dgA zq!;;}(NjRSKeJ-p)O)hdx?Qo~v?fYt4Ge0kFy;Iy7eZz^QI$&ck4$=6ssCDr!9Ix9 ziKO{^>Z&`@vJ}o2A^d5J1gM6I6?*dyt zpx&WRQ@bVIKssD)#lnMZftn+X)xN#$z|SZ`%DFj(2BuWdY42AFFmk}!qV7N09?8%o zd)|d1fSv;$m`(4Yw70{L#N6 zC8_88_tq@>-p*QzF1Hg#e>z&N4@GK22jP8#efomiy({65|2ErJ`Ht}w>!Ir{wgIo{%{9$4*^;Q^PtlOMn zJf{Sulx%-K9khE8V%aEx@9?>&poh=?U8y?4QL3`puI>BWzD(z*g;n|kTu-lEX3PMf z++G~7BdV|4LgBT6&dim)puEI+UUBu1)28bPso_SKEQ?_#K>F;YoGKmbS$I?n{J&I^ zh{sp&cRU8`-3NjTR(@s58Xb`n*uy?(YvnpD7CDcH{Jxt^NU1bK+ueoK0wGfdEo zxLz%^Np&UOe*f@ycVl`O9#+?=LoU0B2m2i*mJSepJlAoOrYD7!=;`VG^t!CHlvJ-qfSOv)d2*0T0eZ5dl5u~*k(CT)yYdqxpX zKyDn24#`xi8dRv>tQV|8nyyRooEL`fV4urQB-cNn?o!u=?S264lwrSif>@up$@`{6 zeS&E18UMncz~7&FJO`$&=b-MASW?JCdnQk4)C9FaOF8v+T5(d#99H5!acz2($$9iP zYoh;hJY#K0GwTbr*YvoyUd}XepYwlnr0Wz=EistXPTW;=RTU}< zQ{9&2Ne)z1RI2?T$L^zY*OGIollQpYj}Ka@(vSCC?pfe0FXrg_Ek9ZR_Bto4Axm?A zRYxL+GYe@btPV48Ly$P^@Lg|e`HVR$y?V?NblL@Frb@SAeLKi)a7(2L6J_5ccL??pC|+m95HqAn{nsqbUGMNsaNWE zIh#>qIDhJ&jD7Z%PckLCn-wjIHd`H_;Z@-R$U&{ zm(>)VIs}zjIrzWlTV0$K#+)DMd!2CEc|k_CE*AnT0sG`Pbt zbZlTUuj~I2B=|uRk8uVR7T0Ke4Gfc0kyPw=u>}vP#ZQp<7Ddj$qu}d zAPxCiILNnE_Dsu7KVqZqP!~K$vMNBtBH;JL8a z><>~=lqyhGY`6ukmlOIEaO>oBk`>T9Mty6ZXn7feKlj=S(fpmf1Qm{FhUClDfIR*O!;3 z6Jj)+pEuADF2ciOY}~!?X~2X#5n+yT?iI{iw}(smg{;$EY)e!;nQVr4v(rlkAuus^ z#JmjmTht17A^pkln*vwSPIf$;wj(0=>MZf8-j?dVMLxrvFyUgkl}DTE*VplAde7JY zaEO{4NwV2;{+sFk#VXcA@)k!M1dBTk~Do3V0xwANExm<^-j$_V%};~YQz_tUTHQAeHFmpP&*u9rOU=EfxsyU_Qw7TdR>eiMNdEtx{Kjh*EF_MLf^u;7*C&k zl4o`C$bzZ#lRGu2Yo4H?L)qW~& zmW8-HLyF-O^ySRn`jeX^5pi%4q1h4*wb%8gS+-L)W)bXvO2?C5n8u9sU+UMKZxd;H z5Poh&avR0h8txV8(v1topS77~y)|-qVRG!H#>0yhdkpPf7oVWEFn9Ih`9*`LMeS?xa4JyzTR=#XWwutFVu}DQ!NyI{I#MXj+4hxu*T2OR303 zfv0djeEsOQxHsNJz-(rn)kn);Nw&DO02&Pzy#4(n1{&K>J&fK<#M{yEv8Y9kUtN4M z$16_btFG=|$I{$^VxH-6s75UWoyyWq!3IIJ{My|s5@-I{wJ4j)Dx$+pmo0K4;6Z=1 z@7Cy2L?TV*nR+HGp6p*BlHwqU$*b1+%^vCV(rD5V*A_YtLV}e34oc=~y-ty5Q6GPz z@QW$&N0J&yKOh|FaBJ?I#|+dFBB>6!f9C!$rmVcf8(!3Z}2cJf0yMaVCxgZDS5+oR`frK zs#1F{xq%#!fUGZUpIgW#KZr)Y=o~QSyFL4`a$@>ivX2(()rg z){>{D3h6x%@Q^k%ibZyCjJjBvzajIfjx~^;B2xp>J0kw@Q;ZuC-$g(Z zn2<7H>{*X%o}ryZz7Vrk!kI?p&cTGlh1g_`T%pI8pSgD)S#*$iI#C?F0M$XkIvt)L zx+0YKiuH&MEB$ANLbzY!ISY1?x-`oU6?x^G7k7ngg_h_)SEB_ByyyU7-*i}9jrce9 z&M((@BvMxxQr00b|DUB}Ab;h*Ro=nG=%=CbuSlE>yE?iKFEAL*9OQ*$kNcO~3WJha z@Rn0hygzg7K_G$sziwkh1)TAT=@QLgeO-c{<&ZT2cUof<8b$g?1p3iFfn7TW-&9bs zy}$6AGst{`EcAAl+mGywBrPaBk(YNL9gnLriU8%StAKO!BU|aa(A{Q`msR`I+umUQBp<(zj>Rcda98q_z0tI<(53{sT{8pT%i@9E-#3 zx)Ykeq>8g(4=y@QhOg1Zwy{i_(F+serHD8w!b z{T6B!I}cS`jvnnul$aN~m8(S#RwAi6x`cF3w`~^gaxDdRvi8)F-^2)P6MjNEgs93T1};`jOK48~=`cw58J~i#%QS6T`X= ztBd-nfR^=O3nQ&%a%Q_4;A&RLv>a;PFKBgW0g}^3bE|rV_@6b0xc^pvcGTLKCqAgA z*3@@ovo{mV%uS$cEi0*S;1QaQ_Y8jjUZLO8N_+Ti8SM{B8h}u@@lsCNAeGL9;g*1B zks;ly{GjgeO|ZCkh|$h|y2)L%8naA;T(Xb9#g+jY%U9fM9z&Kl{K*c0S&WaK?tyFj zCrL)12}>TP28bEl7cnB)nda^$ldlU z59Zj`9)m|)tKwT|DB)ZmzH89MgVK15&U^U)93a-{111vSGb*I%)0UA3ZvFp4yLFz6WFda7#=`XuZkS~4Ne zR$)tFqxuZ86URk)qK%eJ?E0u$DUOyr19)ah)Zn=Oj0RtAc|jD3w{iEQER23ziFxCR zY8aA5Y?3w?xXoX?sbM%ep-Slnzbre0;1;Rsy-E13(K>9D9?ie<^pEUn{JHeW^&P?7TRFpQL0yj28$8FP~h#?~cIiNXkScwox+A7euoH5f2&YbsK+V zzd8bRm|fTqU+1NaU*V;rUW&kXjyY$>_{fL-E2JP3VWf+o=2@9dr_@?CsLg|H0s51q zoTc1ekW637!%~oeCp~~ z4UEgNyxoO-5-8%U z)zRmMbme@JqC^hfE?pHK)6pk5vpc;XIWF?>uGRnQK2z2Gx1ymTg<)AT_t;h9CgRLD z+BtvC3p%I+jhyiqEx3+srlgweA+xBv(lb1f1kMc z{JZ7y%SK`x8lIHx`dFR-k6Rse#kj?!SU=__jb8Lwm|-06i1hPlkcUsR>@yt1pg8t>gK{6&p<8;Z2Il&G(Ay@I<(E}yPUAi!PIz=Ou)de zO*6}WcMW8g2TTdw_6Xr5P0N}zY%v_^)JdSRHGs(*;Xm_eQ|x$3WIHc8+!3Q7!}H2T zjofMnT`h~N6JR`e?pz2qLx)`BV{#oRm<1sdSH9U?mjTYU1IJFP7v0alixCjDjk?eP zfCzXQoWpUwj_!bMDDT?P)W1m>LstR;n(#7;nwfF+e5o?bHEg5p2&>2?&ZpI_LcQ8` zb$?5WZo+Jb~Mtp3NM8X!5O&WN?x1Tf9rkZy{#smnjGZu^`-8Y;GU|k z*Ka;QEOx4SYaw)PsWPK|dd5yu=-WV8e1jcW)!; zM?{+0X*>}=h#yJM(^V)&?hf*emhE-t)%cg3Qbhn3$xlc1LX>A6r#uz&CT3JIr|Sd9 zq&b%f<9#`+ITV^yKMO7-rpmuEa=&C90fId|`eKrxDX%ISC59UW)p!Fq`Wc1hv#OZx zjwgj8z*}W+CH?R#4T8_f1D<65IqY?H=OlKY2`jkDy<+)IE&TxT)OUTUzjq+?0n~l+ z=k*-Tx8xSMKA>lL$%4M|%3<1gnG7k}grT*$Pa9P}ss0i#)}<=7+#YNW?qfki?&zrT zQW{10o5BuKMYw>ZD#*z9om`dwjP0V{E(7_9nOJlTS(afK@COGw>Hx&Eax!|dYyA%{ zQT;^kUk~wC<|qO4O{&n?f~pnubmeHx9|&-hlv{9&`8JE~rvBtG2HnE=*Cl|49V4yk z+QzW1El>~w-alC3MeW@FXk+n)7?VE4d_`5QjZzzrS{#lpM`)C?8gTo#fqctxCCJ`l zdSqz^oYZM;ViawMrxjnXAb+0?udthQ7&iXfx~HDq&N2$<;dTGQ;fvoLdpj?hH)tqL z$cNxCmVs!;wsNBTR^1u0N?hwqFJ2zZum5=fzg zZ`WGqkou?bDpseN7H9DsZOci6#%+0#KCbcq#>ry7t#s;=zLP52|lvVg~#Cc3+8<<>lt)m`>bixAKr?7 zXD3M|Irm%me-m20(F;?ItGYO3o)GNh?o91pL4LJL!O9KV#_1kuVE0JOD%UhmG5?o# z7hQu%_o*)_O7B8&I@vfPp#Fi<*5d3eNw%i5&zxJNi!9& zk#Bh%%toJ9+`DFdvDr9Cd0$+2-o&% zq9%~7Mmq;R4*M}SgADcikb&mMn7uwf+Y$l!SG9vV){d6@Fgq@3$k zjR<~8V*}}grFQbMA?yDgXamI8F$a)doEAUl?;nA*xV5k8H?G3i7r0JPin=z|TwGj@ z@gYXRxI2g*uG1_JY2l}D7F5j;FWY9YSP+heAQU|ggya^88{gy+SBCQamvTP8Qhz@R zse}(=dc2*(Z2K(B&3qMVAg3i!3`WN@j6w%5&4<)IB?qa^lCmw*>~%`4(>579lTBNR!$znD2`33B`V~H?NS=AX9yYCq!=Q^L4l9xfn%Dt?$MN zoMr)&exSMM=1;bghrD$$SsLM~92h}0Z4Zpehr%yuM__1Spx@_}3UmdOVxddOb%pob zRy&?$$#G`k8v@X%8240XI;gYB&pV)k4F^Wjz@}K#4a!4`Jr`(H_%)xVXtqRAP}e4h zB(bXfB{*#>RIA(SU_56=1)Yj+z&#*Rae69GJRkiw3^QN=xiMsIP^6#}gRRzEcM2{w zYT86)ef$cq*I-BFIRaWINw~H-w+>rvE7HODvN@n^2e|)$x!c`eo_6XuA%s*axN&(W z4~!N7$l(66@cKrM^dGDvB4hIV87T51jq{Q?5YfcdlUxw<`T3t9cSL~kX?4BO)L1(750tytqPhm718p#NN~e*Do+ht{*Q= znU=H5tZdH@^f-nd;p@_s|D@r%mXXrH_%{KvM(3&RS7fV#%6UkA>>84 zne3N7ZCw{wxGe!a;cEf@7z-ulfq;yf|aIBSn;h|NG>Fk|}4)gfkcG2h>ASuI1~^9n3??;;Bi}EU+{Jk-5y+v1td??Qpt`ku8Q|2=y3F{T1dTjp@x7ZWWAy!5tUfv zBRrfv(1ht=IO$5#$21iAb~9?!oug0bsrjr{a>>*5;iP^T8v!fg(=((al;e{O68HC2 zq2Q--XiGpE!Ie{B?@-tMNS7}oFx9QOW)1)5Ka3d!yhJWBVB0Nv=MxS_hRxu{z(kS1Q#Om16ai(oUazIv*^l$Yinz3J3we^ zy!?_iT~+^GVPa(AhY_f~s&Zyw1_UVY9q9+FPd)++)XlF$?b@C-20K7ixWV9C>*sqD zH*&4M(nAoi%)Hb4S`@-9q4_@$RO8ajhVdIM6E^y5j(*j<&W}a~@8}c3@@a5ctiR3s zr-C}|Q{Ch=A$6f#KJ2^~=2^r=xSZxb>^*z*FLZ#P`twkPv?b@Z7HXBqFkGE%t~7=X zu@kYW&$7Kp?e`GWOCTZ&5kGYm`-zMgnD3bSkt3aHR;hp3f3bRqb*g>-T{;tzX|wix zVd2Ybz%q9WN&q$@SZkf5_D zgWE8@*lKUMfBH3@A)~(=UIw_a?lB1Z_FlXJIvd-on{KtTVS7mdW;*S|nh60#mIS*yr#lYC|-zeVf!Y=Vhk^a*^L zY-k;*cbi35CUn9G@Ts+3d#A}N_qnXd_pj-DXsT_E5G9y#+Baid=*5Q>*=sY{~j*1 zUY&Zao<6iLt@f3srtb}BIklMKqB}zeXQ>LkTG~O2rA@`9wZb54?%!wf@$vmFFDxKv zOaCFeSiidxWblscuX}$eBuqX2T{OyYcQGN5tGkHgs-NhpFily1Xr(8!lQUM{qEXNe zESByR>NiH18-s=Xq2%*GN6k~it>t*~%V65WnoXuR4%T`TCgM_)}k;%iZa&xc{;F>&>_ z&oqezWq!+$w9@n^jr6y|llKJ_O4S9*a|VOfg7gw0hE@>`*d-PsT`HI!Tk^wf}$eztKP{Lv3eW4so@ z{GiZnEZR-zO-Io-!hx1c*Fdsv<_-Jkp@mLeo(FrzK>o4*er&z9upEH<==zs8uWjn| zD>)vs{%N@K<&;33BEOCA1}h?xF4O9xMGdO+*idD_t9INJBe-Ku#dqGDi20dbgp4GMl){o5H~JN!ukJAhy3C=1g?;<)H+LOH)j5u1e?LE^0>B2!d^S zIv@T34>H7%KS*VhRFFEkS9b2QVxz7kSj+3BHdlgL+SJj049@7CPZg~CuIv`{T1H_4 z*oe4mKPgZ_5;>zY-p1kHT;8|ZMa4V-?p%km`0n|i@v#|kv`en_%DdTd!itNQOg}m^ zXn!Voyx^0M`F(4nsm_4A8q$#6WMA2X5^%SLL)3*;H=-v*NFaEK}mJUvbHm2RgiR!;(5qYM*4!UQot9h2O#DG3Z? z!;tOAM6xGuXm*dEe%DolEtB*%C#_*eVIyeEiE4NU8h*OoeH|a)6MMkbBIkk#{$>rG z{W}-^M*=OQaD)a|8p{TqbJX5-o3$OQ6Lj(2PxD0L1G*^g#IzTm$Pu60=rFsF5v5wp zRQ>8~&y-OwSe>Ont|m}X{pgc2IVx&-_pPOIC9L$6_x+j#+#S$n^Uj1Dp<4PZYEBJ0 z@dMcd1pJ#JWJ6H%MgfiPTq`U69UygWY4|wf(vNRMJPcTFU8OqEAobzxsvAi%NxeA*PS;M zbxk&9Qp)uSzbng7y887#gVFJaH!_8hU5ETDy7 zp)YfC9n*3z<`W}o?rv|7cYg=HDVxF^=HC!Rua34Rp7pohK|fZ-d~EqZ)1L0SH~u1b zV%y;<;8Cp6C68^P*;I?h)K?wKI1#nuO>NnJgKXlz8ru&eys zScQ=~1v}jAJe3f3b#swgB#HC(sB%1L85*r(n7#*QxN^`d*2UTyuOc!}C#<>5o$h*y zzHX2r#z6zH8V;$N3L+B5fHgDjn-kI-xYZbZbCho-f7a>(ZIwtqEg^x_g*8lDEowk* zl0a_V@S(}y!$5>&8kjQ*h=WGN@T89!V4X(6VShA7l-+}(gLze=iE!eNvpyBo1R2X> zt%P0u#j1KCWPcr*H^&&}!pad2a;O>AJgRdRzbPT{64Z3?VO-08S)$6s^!u+eF48fr zpN|LZ(Q>dA*{>WZ9$L@+qpX`$iyj8}9|_bkUTcL?HP&{}cO;IeO<|D5yq7KN`b$Yk zxlKO;i(;bxIz1?B~f&Eei*K81cyqsPjg;}r3WiT zt@gOfLFe9Rn{reg_xeVTUsi)cDA5jAclGamq1q~qp~(G&;s8$Lw`}*Hk({qTfVBRw zvUb0Ju~V?``S&Z02GkGN*?=>~@Jrdte^j4)hH}{rEq=eHyusJuAl2YP#BBt>gx=}t zaL~!R^c%CszojQzsF?G7JNjGkqs_Z+KIdtM3NVfG9TD2lK1sxKm5vnq&FpAiIDWPrUPl^!^<<%9qTDHkv6(Iq z@Q`-o(04R|i&hlzj%;4y>P#e+qX~2)5}3`lrW&zMhh~l8d10m#(~ke>wHE|DmMNU) zC)K{tXPwd&`Jm(6d;)A|>8#nh9k(+qCnoLKbB%S9726aAH}RKhe5)>jKfF8s%DAaW z@uBsQYZaZK&fOxpfpavdKX+KUR}bUJpt+}wuB<+CB@1X9i%Q+l(2yIo)sW?IVE(@Oga1gJ_ZzJQ;<1pVB=+cLG$!Lah*P;!ekFVN-KCtVDnG5vnig;D%jg)H`q#HNo5g^Kao| zu3bUeB#PVX_@Jyb~$ zMbrej)J2zQM!MiwF#snO#WLZapNe|b13gh!3%fc_3_xxA8j$dM9cPM$g~X?W6Qh-< z(_3?guOjrI(j5BGFJt-a>8J@E&W9-UwQ5U584Yb|u1L?-d~R+HFV9j@W-avFu_&Eu zBB)RHPd08zagV`d+%~IXK4EQB{cu549&}rhDw9nr-e?@FU3Yocf4YOseNS0P022a+ zoY4aBxI%x{Sft&Hgy+`Hw8e_Q54o~`3TyqCo(0lMzLi9rXG8)4k1b*pR)@@{j>S7s zdxSHfF^H#5B5D)}U?>rJCh7_u!{w-w>W}T0D@;Ak2 zoWeh^ji*?~YxCjm@?bmZkqCsO@DZZ`9=L+a#GEe(2%~SZ%@HO$+ss##}ryZYp$MXHWIZ+ z1^ba6*bPWO<2AiU5xlAxnEb%DiKxImZ5>#avQMdm9FhT7GOH&$0G?KuO;T|HF`w6G z$1(1o)ON(wx>xd#Z~elEN9kH@nK&0x{l9;;)<2_2%m5|q(`V}wwkc|FaowJ{Kd{4* zx%ZQ3_D@J#7kbDeLfOuNV(?pt*cb#LQ?Ywc6UcatRMh3&W zW-&G6%QK}G`+)F_j#<8!b54ZcjCGbU|1;MACs0wpbr^A|sW30^aN5|_UZkC3V$gtA zfb6*|1Rs?a78o8fd?{i`#MjcKz&z-gx|)|zPS)G#eKo#SKQfu5UZQMflknHW&>t8; z5ZCsh6wtA?C4s$AFG0!jeb{L8@*DT_YL~g{_cOL^=Cr>W_iVO#zVjn8;>oe3WDqzD zD`uJWwM;)UI+2+~D%s$}7?a2Z68U#9`uJ`YWy8^p1P`NO=uUIe$d!I?yav;=kZ)ml z5Za<_m2Xz8AVk?XRIFmW@eX63_vXGdRs(9_k6`{mXeL z`u6O`6H^HUdf^0w_-a|Z*{1wz+4O%o{rt!Ll?eL3GAyOb5R}>ro+>Tt=}Z*Vp(dhzB!K6DbYe|mG%W?^u!hw3`@89Ls(OUuDu%qbUM_?tJAjf)TM;<|VQ zc6IHF@=x@0Q8fs(3tSEeSG@_6ygXCZ*qj(BbPLbc z8Ifp09pF&mjoFHn@|Z?DA8Q=X3GSJSj$wa}st?#+p(60r746A|68Uu(%hm^PI~ypw zewa=IA8R=d$c0$T3}NK@!e{u3mlCdYY)$JkXtywry!$&B(4Bp|!rUeE0A1|+{`llh zIJqi(w=2E>*6lT|ZitSy@Eq40iET68u&Jb6IDTKu7zqz6z4ONs6wc`G@m!S~2F28J?j#_u?}=O^$7h1q-Xm2kVlu&`Y-|D-xSVQ-o+qIsuQCcZdq< zEz|td`!@PLHdI$3FVak8_oxMYes@My8zh@wR7HW_kkHu9I)Cc$`1$<`+HnO3{~r4x zPboN+)YUMKk}lmPF#ZD+hi6vCgOWEy6$0uAf2G`1XvjVWqH=+*ID$IH1>q#35g>e6 z>3`vd4&d9IhKKbXg5_s?#x0BSm3|C^!Bf6Ja!*g!C%AuM}Jxm zUA&%XFFr6IzM=TF$HBMaMhZQggcEG|HV1TR3Rw-=jf1G71^_^!b>pW7R*Q6}WN*EY z8n17Ro|KSsFtxmr3wJ?FaKABH6jeAlLa761MCcYaHHJ1Vzzwtz?P<;>(s=1a4wivL zt%uX|mUJA1wtV8RV1FItCOUX2e2d074B%MQ6rM$={=t~_WK7R&7APT-a1XU}~+R;_A-y@cLc)NcJy<%}gqWwy&&K zXm&y_#8=hBNIgeV)pc>-ZJkVJIA`kQI1a1kMX3_)y~q_{ZKX~NYVurQx%L18=)?bE zTLX)WSw?#5wQDlmhbUt`QC))<1E_D*S>PsjN~J#UIt)=M*=)eKjSpB%FQ#!?@c#Tp zsMTt5HPFilz&FFF9_R@^K!Y0~D#FI;hK-qRA>m3X+uE(}KM!$09sRe^r>-2T*g|QY zdWQ0>Vd$73JO+Gkz(j%qv;UEY1$DqZ{}aajy;$`Sxe_{{2l7k#F5@(XP(%-S&pj+_ zRu()Q=el4zn6(k81JOZJs-`0;9Z+`@YwN@P~;31F@AoX9m2O9_ON{AUd8XO!CTNV@q`1$tf-uj%7VNB|k z{Wp(GC~E@dak47&>gxA0QPat2<-#kM_SRH}(&TB4sQr-0k8F)JXbZqzBqkdikqYs% z#|6J5b2r6J`t8vN6&|Zo{_Dc^jeBReHqiZcVfEkemC2-=2l~i_=iM-982WYu?1>b; zN97xMKVA4_{`V2@bLf5RJ(a3jXZ$o?&9r@mDrAFWP#=kcyq-SRikcm!!KAnf z$_JV9a%eSWq#8X0twx$NB0217zd zCyc->=jOR|!U1EF_(I>%kk@Ld8B)S1FiP?i zvp-bUvHcR?Tfq*iaZIM@NXfDi3{e0sE=~c)jPTF)9Y@%M^)0bHKST;N z5){Ne=$;_caumqE0nve>`VIx-FZ(_`TFURrxtL9wRXW3n?feLS0ixe&ZvAa)3>B}f za&37O9-}G<<2)w%(#Go!bl*n{kB<$9K6v(I!9pEYto+yiKjxLTG;AIRGFBA3DM;Jr zU*$2WBTy6KX88eh&%eA*dLI464QoxvB!!iQi9wt0uonE4-zKXPX#L_Ea{oh@N3M$a z0yPIBQr>tUqME+=2=`vC*G0XihjD+};hmZ+_0G=9!Z(;X;4rvc_K2r)t&-d|Q;k%k z+P+9JMO}8qZZPKz6rsc@a(Zp~^tn&%a(u|@h!gpBfog52z*d0UkeEU(h*Uz#0dK$K zX3{PK&nq_@Y^eP$mF3*XRr&L0Jk#KjPtF`GE&9AP2Wyw`Da*_CYX`S`^LoQr#>ST5 zrwR_QIR$I)Hm!Ka>PX9$1IWH9w@Z1<_=8Tx*Ly*wGp z%lp0DBII?#-KlDJ_ZrEly6n7RzV8`G4rU(cdYC5BC*v>IX{wi-M}p1T8qea{rsO@46ZluDYtUP^L zgasxI)cA8F&{S!iXMA82_LFMtZ)jyQWTJi`)7Q3vYhZEb_#YHZK?KPzqlV!R4%DWTRItNlVPF`EVFaHty;N| zv7u>v5&0&O-ozzCbmul}r&%V-X%uT2T|Aoq4rrhZDfPZV$q>G|$D6`~*?6V67Xk@e zd1X`k8Wq2N0uRTCp85A!ve0xpeG#TllXioj2fz*abg=pKAB#5q6IUfR9vzW$X%}-Y zgMoeNEj_oll{63f3ukL&LC;p7*UoRu>#wm@kIlVLI=0PWqH!jM6YGk{69u%+9h6R9 zcOHA~(Vm&5HpYVZXm5W{z_9-^!oR|H$YDwyUPjm;SY9v|0fAm_mP;7F{plv6}pzczmP3+B@Io$Yc( z{rLB&dG7L1y101T0!Q5M@&yawvL|Bc0{W?*XX)LDP~WGKsonR#ME_U^kyNcy`B^y~ zW{JU$HJ#480m^JdEeDNIgUSv=j~j6;M=uwp z0(_YfEhl@P7&oIZ;c?x{!P%=+yKRN=5upZ#dQeaWi3SwI zjtU_zI@_IQ>a06P@Q=zG3t`3T`g93tWNMe{m~ zXZFKgSbvLF9g5h%#y6; zM-rGLch+rWQh6|)5%2TI-qJPN?F^z6Fuz&hy7ZhQjm5c5VDj_Z5+mk(=fgw-c8fPF zDGNFjjde@&4aGw3YXggWs2j5jpIvl#T`R)b{}g7kWnIw*6rT4CGBa7QT10JnKCC@| zmrN~MewVcpI-60bLaI#cIs{{oBRH1*$|W<3Ow0ExLY1G`4JG>V>mJ_2H&-um+rOFw z|4KGLGb?1Va2kF~jnfGQxF6$RriqTz0H|kK6sK;f1HnqMCQe^btQl@00?{@`0V zkg9Uvg?87+;IQ`~4$1B=0}p@PJ$T=q!H8c}g7x5W4+4-1p^y>m(`m5=YMF-+)r9>K z$1;YsINZB`aFDiT3*8A@OG`Q{fr105?DTN!4b5Y7DYg z0kWefpGvZF`Bz7QSCKW{&f<0G#C=c&s2`jD-SLr`Cmqlao#qL5v7Vu`0{-|ShK#w^ zwK(h0uylxF>|YSve8Z6AS ztMyk4x-HBn@y0r`g-BtqRvmUAt1%Lhf-#r}BiL@`ou=BF<_-z8d>kN;eL(&79Jf=h z6SAoCcs6WDhp`2?-viewJ`KML*z4F2lvQ)9UaJanP?YO3#s)5-vPw`;s3*S2@EeIN zFy2VB{2W(Y#8PHH^|>_C{he!f3#pmqpn@#L7}|FuW{ht7tps-ytg2qFfQdHMdArUa zm&&g;aaGVAR}4(&qPHTu5+z!ZPy7qAfdzYZMH4~y98PA;(br73hhv_8OgC4H{qSCf z^63udxx1snU&vkaRD&*G%dp-u!D!W>`oM5Zc&D#!<7+`!P;KD)zrWG0mXA0wz=t|w zc}VyyNDMU(ac6T&J>+(HzcID@>MZE)ZxOYTk_Knpm4(uEu^XMb$|1KmZj`ydNf=k} zx=HprbWORt>MHF)Uxdx;BUn7U8it@zr-Qrl4?`ai%#YD+NT3d2SE3jaOb4rRZ>Y}4 zp7oNtA6{lK&!_k z%k-kvBHf*RnLQfC*(&t$(N7>JKk@Jzti+_{SCdZ~_QN#Z$SB znt{UMEgz~5l!}uf5{IH0Ofb?fJ{)IENL3S6O878~!V{%5VWCQ9^nl>x5ippYI%9$4 z#idKFZOh0wM(Tq1Ug0Y$&jh&V>C>`9d&|~in^Ij@WT6-7iKlETQEVy#k)5qc_U@}u zS$HU#UyBi89V`#+tv-&2*=0pzo=UUf$DJE(2d=!dttU~~XjoZJ6Nkrv_WNRk6zU)D zTW!u-K0&oX#C1YZs_sh!W@obYDl}{8MFNeDWe4W?4>ArT`_tS?y-Nrk7qjcvL z2HVazN;+NQe3v(XKYYm%4rNo__R|e|&T`AQoVe`mT9fUOU7|t9ZS4ddia4Q=Bf}A}^?xMHFUm zyftSw{dn_izxIzhpzrQ@4lnNJzXQSTcseCOHuT7ZgGWE;+Iwas`lwfI=RWxehXL*n zUd}w7Hyt_RDLDV75YY;JHe-&B|Bn5L4b;KnAa7gAK}c7;;DFaK|7C)w4}(naU&jKK zHihbz+@Jv6G5lPT+zIW`NC2WLY!t5Tn`E#!6>7vQ~6EhkC<(sd^^puiL5JWH__s_rRq#aNj7&) zuyyf7Ytxtz8L|AYnFc*upKhFVtxNis3d`R_nPi|uC-X~ufSjL1actKumB7sX2M_M| zONBTfgDsOY&nPnNo&p7`T_Kig6 zaee!tz798ud`d3`Le=t(%3c!0os0?V7BH95A^^eRADw_0G9!G!BIQ5@ZGY__RGp8A zAS*|$>9FoT#@OF?a;2wj{dCsIWyPwBLo=T17SDLtyP9)Rr~pwNn}&EASBrFVIVR2I zNL|m=exWrOE*U0bv8Mz1dZeS(qhxhWUxUBiwG~7tZ!R z$Dx|dWDsUx=g8TL+NA#g$@90LJW0O4WPY`~x?r+=u(TF|_9cGLA^kLCK zJRUq$m}=EP0TOS8GNnoTr$(%;k!H+!YFSGN-PwP~LaXDND8*0mCeQiy-;-~Ruz$Wx{LkxRxhrW^!-c^B+UVcrnqtr3Q=MC>Dq zQ$Bl>WXxqa*pE_+#JGP!e9r(J2FZ|vTNZ%g6M#!FGY2vIl4*yurAp7pQ!t4x+dDgx zWrMwRxV}S)MS`{2SdC!8e6@a2B83>f_#!a81psPtd{x@TcLBuIABL#%e3^ z-#-)@e`-TZ7S`Mn5%XdfA8f}#YKG9KPTbT5R7XNbU;1BqR>(d zd+`ZNyZYCamoGfj=t|WSu|;|ko0}nH5c2vIlyl^KN^z zzMu-kqO-oyFKSAw*vg3hPK>zuoZD%}!cUiDVjCi$Mb;h$8%9@a;Oz zX^yBY334Obkw9cnP{o$H*B|41LrTRiBb2E$vT2Qxlf=$up*^hn`Kt)nV| z+#d(n$D>(H{Z*kTjJyq87jvT=V^6g<_P9v2b}VobSCjsCZ9qfH25i6gF*1M00be+w zNci|?xnXF%J=O44%+!=*D%zINs z7+?1l`l}%XJxD%wh^s?dTDfVECO2>X50LFQRIRLlXpp} zSO&Aq(SYtp;cElFU(&lzp2z;Wtqg97dtC=-{tBH~c?K_3kWCoOJUyA=^S%6B*_wm0 z7DZIR30qAOjaG}c=8g}8YDZOrg+lXZ^-AVV(fHSjCn@`y+E8K#ZtVaXye}+HQF%EZ zC*ZV>>-~5zo8HQES_i&0gx@R`<>QPBcNWO~-qrbXnb^?uhf;|*;)(Pu+aW-v{?(bR zU~q{X^c@hmUSPGcr%qe;z8>71qyI(C;y~hR-}Aj<+9YlTF1l|>ts$1(_vi@3^WV#> zL#Je^wK!V~|Ec6sIg5Yj-Vcl&`vD>^17HmD7oDn6v&vZxXpXg&x8moI;KIuLJL7)VFrHnRvQ!B`k z0&)&QTNRqdWfDG&mItP_*I3&ATUU~7=ZnDl_u@&co_!&Ki6q5)ZHcDO9Z(#kgOF+4dJ8Ju5G)h)j?%vcGQI5;=)^hQS zsAeg}=yIr%Qzt?V`c8U8h^6KvC$EscjGh@zVF zQdILkfW`0~?HwwbQLV<<+G^TQ> z{6rZdyKBZh*Zm;xb9m}${wn_8B|F9U8qv{P^!(eJP$FJP+bCqnNc`J|CgJtI(vwX6 z<#!;+#OB7Rybw2z^?r1c&4B3XuQU^Z4FAC?#2K@9{c6GMoYKv2QM%H9s72Z9=^g08IR>Ssk1j&?F(Mr2_1}@om}fz@ietQ17IcO%(K7auEO4nU zY^aC5uao3)*fMiDxvsVIwMPWnU8ObltVLD}H^0iOV0` zrAefd{vE}v5w$m6`x=9O#C=Og-^RYcKVMMFFu-f#yCXeK>lrpc@a4D74xjs6nKHmF ze9lNq>=Pknt%pNxB=>xh3SV$6kU*?x1}!4GRHQZQdmHKPKVRHF1ZTG?Vw=`Cn!Q*{ zWLm|=2dg?m=+Hqwewq|=@hwXkEc&)%Eeq9BIvFa zO)%ZgYS&~CyWf9(7{oDv0z%V|o}7YS_8S{(snE`c#4R50%M>hGb!e?%X%evklY?FZ zLVDeo5w7Rkt!*^y>0P{r{pF8mkYFI=j&aOwQPHzy7I&XdKwJt!320xahNUL%s-9c^ zWQ6IZW{j3u50*Ln`XCKmaOjlwtUPe!sDc&;-1E0wiMSBxeN~;oMFgPETSRE@nSu#s z56?CK`NOf##-m!uH@h!vR3EQ z-rJH}KCf~@3*IMIv|9D^YRQca;DuJh%367{z^#|Z)zzH(ThvDVgJ{*5KlZrTs>RJN zU~Lp@IpQL#K0A$`XX;;l@lPvjDrvJj_7dmTj)3)*{B?I6Mm;Q7D)+Nr2d@*|Hq|q~ zU-{7mN$Y#35hyJ}20Cc^7B;`4^q*S??bMk}+VhleBP+pjB=qepI8)t~>0>h*jOMHM zya1dLh+?K9uDFO@u-`#2GgX^UK)6iI&K|l&AqV+(uG0K6UwNZvine*AR~5c2{;93; z^uqViCjq&V4Jrj6&HmfrSaEm}2DYCvtJZo|P|%OztOt%x+p;4X7Wz&RkZHDpu#%GCEtX#Em`^^YKS z=}hG`M~_os`WwKa#LKDi*?P@Z+6V8hoe6lOJzhE1 zw;90a+NlNGob%LC^d>SLRB9X01jCwZ2Y(P<-iipN?OC_Iz6$SaMIL}#eUTFrsAIl$ z4G9T;)M1ogY-T%FcKqXT6(@8o0HdgV7F`}1^7OI}FnJ5H`(k63g^Sf>(nV8wy0JTH zJ~+_-i2FhFUG;4X>+W_LEM8O6P4O&l>-BT*XCuo}RnRK2txUb2=F6K|+I@~8(p44o zCL8zMf|JLaMG58i8CoM(a>Gd0BT!QPVWC9#1}=PW;s&m60&(-=7ED8Y6aoHJ2$?9A zVMPi8>x@LZQ=Od z5^#eItK*z+sGSvO*?tIK_gVu0uR4aYXR``NM~YG#qj^9iGo4>a7#KiWYSsik*T6vH zDW6gu1YhAfERC`lcw9ewxDL*b9~~!l{zwMV$f5t+wpe!lseE<|x*KmYn!EM&@k#|C zYEYX3i*ek{>KCR-b90CV>hfxqsHSQI^c`l6Lj4_xI-jdAk|RKDN5U_t2@#?j1D3se zs{mblsl=eXH<^3GA5?71FP7r1i0&Hh*1{anE#Ddb0+kQ*w}LA#6m zmih*zP%1fKpmA{ZzwMp*!$5?n<~lL|?Lvh>1*cpw5B=0w{<7-#uF6x6c$ymOm z{9e|jPvB5V;Urtcj)?pp?KNTj75m9kLHwfxqY}kLG!%s2LE z;_LENe%khZp>#_*mA1{!lnWBn>K3C));rT(#N!w8;X5G08oil zTc%0**V`2P_{Zkwtd7G;d}G)VNkhuUb-?~E(qo7g%dl*7uHRz;Z4c)Qs;=+apzDS` zBTSdD9Y$ZJRFoacvuZEJmIARgnF?zk@g3&7`@I=eGw-I3yx}dD_H6xiFLN+1RR7}U zs%K|1Zts}F6_4h5n9B6hMOpvP zCM&LLgC33~cOVelnQceQ0>7(bvajy=_eS`5MOMf=Bzdp!+UC^jgWCP@vZTvsZ5rIt zZ%tT-w`RCEiN}Gb|30>kenc^cBsCHqLcZ@Ycac(qy7s!b)r6oZ9D7NQ}KsA7TO_Ej> zP6NUkP)NZNyR>qGhyAFPsq-ZKhEbL*5{Dx$JZUeuEn~SQld-f|?=f>koz4xkydM)@ zJdMV9Pz+y^8GPU%oH$wu^+>idHS}|_9`QY7q@4XFZsZmMkQ_)$+X~9A)*hvr;WE3} z+d*h+-J-J*ei>+(Q8@16X232}778-u0oh=ZZLT$D8brdiYNd3BlG%CbBH&p#yrqsv zi5Fn&^b86`4~@5Z4?-+(D$vB0FSRQ+OlX3!?YQkYUvs4i05ruocK8orfV&`G0?Gi@9qkFC0->vTdW~%M*X^;MLIz?y!`$ z0NU5+GcxQdoV%LhCz^AY6rH%(X4G!r@zRL~B~1pZ22d~=L|XXs>u>_EEf&9%d4e=) zCsMBr*)uM8@vKZ=nu%*Hyu7Wi1}}!%AWzzOuKZt`*!dadHx_}v^HP}tVWSL^xbkKf z-K3DRi#x^h?t!D&E4N45W9=8=5Nb@0eH5kN0Lz9Gzkh#Pal;Z|*hYuY(oAn2){R6$ z?H(1SGqhDZc$9SP%yyG?iChTbS)&4W3+S*kNm`>WZZ*MEeEwJ33f|If6(jPsprGN* ztINygi)p}?D$~8wSyNz1vKM!w@%0S}_9did&R2b9a!a{{?e%zpqHCO6U1>dyufV=2 zalA6K$QpWWW5N$bV;6o1Nw;V899#|BPmLF&erSwt4 zkIgV|U+#Sl3Hf1v7AblYh&2e<)~4oKl@eQ?>F!?(f!Z%4v)ZeZOSOL-FuF+ci@|)= z3rRJgmzLi_$$#E8R;3^sSdeQSjdF`+EbGkG8@alGWAJ0M;;a8W0(6T8!&jJi(_n02 zLZByPBX*Qs9;p+$aYC8p)>4I7R&Wu@g?})aH{@6DiTj&m@qO$G9@lSeYG{VBm-r`F zM=O`B{iq8u-c%+spE%r9uXMk$JOg0c-_R!u-xaE{6O|?QwrsoswDzk-yKr(j)OyU; zXy-T5B;doDQVUh6IvR^siG-n%+b6g?J#wlMg-$_Az3aI0t1?FG+TqH&w`bCASKQeU*^-y47@qUDq=nZ^r zGStS>_lgT93K04kjbv@G0zfVRfwe_9p1V#>b}$B=_JDZ0ImDl9j+p(5TgT#Vw>7uX zw(YhDx4E_xwh`O1!-^?*Ote5{_pu)D9-(~!hq7mZ4Hw8=WY8pwG59B96x*=;ogEhX zEy;NL2&Sl^!1YAXM|^EKz*VN&LIfXe^87jXFbs}rG|hNeUCnaH6`GW4G%~j^5s)-s zmO6~^4{0ZVo+f60g=oFFY?W^68lHAxPW45?Dv{31pXA7vOo}oo;<(0q?bsaH*lkk1 zy!`GW%`PjmqCR{~3F_fS+c;1C>)rD~+-vTiVi?~-wc=olp6>Beo|cl zi^3SCif)^NPJ<0umuucOaMjC!<@-l`4~nkuC|cADyg2NZxWj9pO%?z6CAO^***}S0 zGTCNJ$r71kUhnE<^DKXv_I;r}Cx6NDG7Vzrg1I>;6U8+Q&EV4s^ng9%NJH3Tz=o0V z4DbR8V4GL^arz!=_!ctcp`fTpgt4STZ~G=o(LsC$aQfG^fG|_0>!Ge+JXA7-QZ{B; zoX5#?jbX&>AB}29@+v_z3%`W+4uD(<+^?HzRm^`ZJ0l zsqBV2s7T&F#QS?Ohw^!oR9GDj77mjb$i4 z%>KGO%a2#>oBXyxra_117GVO|Fq&TBYxrgmdi7R)UKwkmv>?ts84bt9L%aWouEg+G zfwxq_hB{F-wAfo*W<5tKr(f|5`_1+o2XnDpZ(vPN7Dtf#ZEn9(5|f0o!R)cXuJMZ| z6_{-KUyZbtr5A2nE`!bGKEOh@B1| zvtI~1U=%#ZC(%b6QvoD0o3^}(yO>K4U3Q>`gsQqn;xsk;UUq3mfqSa%IPrT57` z`6A3WTk@X(ydOl>r&bCBw!HaZuRbV7izv)jfoP(v}l%VXfP z#QOOx?k8pD8TUrY%rB!L=TroKIW)!TU7jfx;SO;=auffgBoLu@6jHi1I6hl9-Q=Yc2`#19MEYm;J_na>0Ea((P#83s&^W@e zJ5yV}JL4iU4fKN^HgbdNCK>$71~Wx=-#myUUbH^aFMSVJ=jtxFmt$9;pvn8}w!s>0f)f3K5yDiUSn9aRnXtf3{X$wCw1#%>P%2LutB5{3asg8|(*%~w5PCL#e zVCR0mab;S8(mP5!=@mpHHg{Xbf7|kIK0@N%)-6AoL4Rq^-edCki;sL=XFbjL?C@77`J z?HwsCeAc3{mk-gmcwxP7_g*XDD8QSZ^=vF$&VpuJlyi3lAv39^>hKa3=bQ}6*{cco z(k~mgU(RuuKj?7jSUbPH%eVe>TiaaFH6Jo>cj7f^HZRKWWl)f8y=!)Du`qR4b5b0$ zvE!;J_!nl0)ey`nXucgS?<ORA$;k@4o*-gQJj;3`q%Z;EzvX*q?QAr&zZO>=kj>5 zOezM!J7_s*tfNw9DcTIPy2odPW2omqfH)wH#J6-4Ypv$1$8n0{6w{RP1KUn$#B~N8j6lxg!!LI#{l?wg4bXl5#b|08gkKpK{_xN3#55M;6@kXFdiES*m>5HO^&Dg~9v36?%+s+)%QTh<}c5S;x0Y&A(f z>}w@I^EVB`7EwY6=d8f<#7Mo**0{GmR?wk`2OE&j`}&s-4=wIUzP?G;B1$D?FRQh_ zPFXdxcAnsBj+jV{uY&z*W{9TAJPF@@XWq>8xnQ+Cv)UacwvRHqyvN5oo zXoXDF3rTFgb|y0x<1uD$2!6ctX~0MMvJ!EeBT>l|^uFjbjD)tx{^$iA z+zir;!{e~nPvj81G$2@bI2@jHj+lGxQ46B^!@+%9|9aD=w~IMU7_$v+jfEqe+IK|A zEC6X|N%YHBob-xV5Ye<|8A%)1R6FQ!A;| zg)9C0puPyhYw+EcW@%`c=`4>3PYd0K_owtcavUdsIZxRlMzC|W#PpezM4S_|RVzh2$ zOlv$bH9`WLKc)rAl~!G&;fe(K-HLCp{syQds*Ez6Wr5?Kb6!VmU|7dcUn&4U^0J(- zZ!B=XZE;n42E3(c-?X4TEObW}Dgkaln5Mkmgwc4J?E;D-(c{KorT(R#p5qB}BXs3y z2!jgJE1xAiujL%sS5O&fkSY1>lW@&6dMS=QkLc&-=)DhB>c@tH9gW-_Nlty0+8Hyw zq*QHH7;|hKk~)8MzK`4_5$Bn?c}RS+f@6oqFL4hLrATW9*dS7`g9hd3bs*A|&p9Si zQW;Tyh26Sw zV5Wx`-KLCI!Tt%wunvVv0ovles&C1jn<;HzCHo-i zM+#uTfwE9-F+9ORdM7f*%G7Pd-F+5GN$(GhB;+FXP1;pz{O!HMk{=;6llHon#t<@D z=%Jz>Gp89yyXajQj#gNx?4+GQ>;bFA6S?lMEdinv_Z9?gS*e)s%4G*iLlQLXPlfVGlu%1PY+^)9cT$T`y;a%Ob;TU6WZg86>aOpl`tRr$ znH(8c-aTmwx*)HS7|nL{&M=4^-6YIr8vS~=&HY7Rn%82wLrMW!?I{t$hPq+NcCP%> z$A1d`AoG`-F!ajypm7AvQfc`ra)6l75+oh+@?Hu>yP7NMNIn@+4xVaPn;~s#X%Q9> zh?y9Ot-naTS?p=W4g-71rqa<@ZBqZe-{2oBYJBC`!_5!LM)@(P@ScA5>Tq?qQ63J+ zMvb$?jIi}kW_|@cTe7|+Kxj`*5?XHMK(g{DWkFgW`?X zZ|fPTMD!A0gzE(-;nh!bFIcsn1}|$6vklL$iHamcBp#t()+94_Zp57pPs8z7493r~ zyDjUXTudsM?PDTR=X|UtMz85k%Uhmx-PYc$u5wcbwRi4T9?uWfoBZ&JkPZIx`!~{u z%f1^({%TF`s_U8HNG9`I&IdnFv~`{J_nDDqX{8#q^*`aaDJ@&FCk1$&)h9u@H9=IX z=kro&P3`|xI(a{5V#32P{HcCndIRzI!guW=XOYV>ihU^DYos8GIWRo2X?i3ORVKvzgxpJ+_-F5E9%4l`p}(9&Y0(WMzYJz*Omk`O;7#w9G>ts zWLai1vNhTWaQa7Z5XT4x9qm?VSI645P@1N^6#V(}n3?v>)=d$kT0=ZQAbIVBT!aD5 zS@lT7$U@HsB&6^c3n|se;W}M4`6gw;v>hxV*v9D# zx4iKKTxvnE2)=Ii$J}k15cR9NMGgfFf%m%dEtaf*2!GL zo2uY3X?j!IvaasdO^U6g%Zx{d$B5^8oss&+;>w_Cw=uCP&{1mISL*CO&AiiRU91kz zFMS&+zeyb-xAjM1hDJG#HGnUsPka41%~T=K%C~VpKYX%qr8GbPf#&P2DYk2>eU#1p!WGTtwQfu zlcLF;UV}FXZmQnyJ)i#D>4jRtIy@yQI1TUmZOqRWx}-kUEGK5|_)lL_^p%CaER3)J zCNBJE^?@%odb34ZA~)}OZ(D~TRGHh((l~oVfaGn?AxdD}kEy%2qZQt7pJ8M?NHCVP zsq@u->{T0`!(qC~=*GM2#ZUhz3n$pUO#Y9fvyN)|{i8Sv2uKM?Nr!}l(xr5#bWD1J zzy=5kBHi5~DIpTl14g&NMoKdVNcSk|{C&Q^|98&L*?IQFec$`Kj~_rX4a@zV)CG^W5w+>}X*H_wfm#<6Uqe zp2CF{@dNu?TYSBWpvIUhfrp3uLT>`;0UU3wih4dMvHh8R4J%Rwo*dq+U$Ici8?6A? z2|3Zwr)5_gH1QcrXBCGEKTlwXyBUO&b8P7ZL$Bc9mSLbYyR$jz={|3!*FNRL`wSdt zJ@a8)N=BN`vhep^9wv03+_QBzx-Y&AW+q!a& zYGZc#@z7_dU*t3Me6QA{!_Zzx(G1Z9f}SJx^)yNtgRZ2cq-^m~QH%0Wv&5SxUn;ik zxKN8&uAk}HqEzA;>;Ki{&tM+>F|wH)D>M9TKxs$8+Lbu^mwmH!bh-k}*CSpHAobt< zFgWI0SB6V;x8W`EaW=HP-SPo3JF7Q6_@vPKQmM1;GOBYEZR}I1yewLd|7_JrOJsSV z$1IFjv$8srXu~by%tfV6#$*dA40<@1zObzHhLKG2Hr2c-0aNgJ+iL^)v%UT9V-vnu z%wG;_>q#b{fnKV7!JG!AEarUr+@;q=|1K^o$J^L|g@SY(^q8OlM43xncIoFP$vdQ` z(CM1h+wJ~(WWppQU37tz6>|=2NaDq){q)sYq+Bua_Qw1BdHu~ABfuxkS7t%LM5FES2LIcmruYO>R1_RKF|A8NQAFEAAwusEW2m3=Ms$q`fY+& zEp-NCOorphJ)hN_aq4DG@*R(h7xd4vh(=hebi$@{u9I~*Rx^3sO6!4t3Lwa!*UeBAP+V*`2mCx6{|1% zF$;kv+U{gB=f;?oljNhJgXXgXL#_e&D;GRUAb}xRctIoDM5>728F^ zw?L5a4R3Pk`tdj4Mm&<|UAhmgCn-k9w1gmD6pZRXAhLqB5iCeOK9o`MUv! zFCtDLrB|^-eVk$C8=1IMlao#95Eou1n3gnA-&-cUK{1mqIsEoE{X-}@L~TXi`OVXP zJ|moW`+B5bbz#c??aS|#)Bt{Ymzf=L{~TRxNymf?MIfDVt!8boFELS_S8;&qeca!q&>s}_Vnz8-wu;}ST<7)F`>jmN84a{D@9$N{Z+V?7$Q=2jq>)hba zq<|izn7Oyg2G5Q9R2Vg;2^zJGwp@@O10O)gEo6&*69qApF%CRWuyC?pOt(Ay!Wz)z zzUi*4;SHcq!M!Qz@1NHo(rCA5MUP<_Q9yR1Y;q4OYI{BM!ZTj`{IZ(kY@=nhx^va> zDXib0Y?#yLBckZpRMG?r#pZ>-*J!}4?Is0PDhmG&A-?9z_0ZBK8?Gke9Vo(A8@XxVHW+}pZD*BSB*#C zQ(XWCv%vZLU6%gWi%cDk;>0oH5hf&ScqmpgGto~01@iD7HW^f(b>Vyy76+Y0*U7+Re-gzCWf-4@O!SA^Cn2_`BA#qr zk|1L*6w%j0c{oUd6c3go;sF1bgrVm|OBAB0f-u4FE^_j(tfN3Zf~ultWPcf&0a_@w z-!uY5a^WhqpzNalnTHJ>{zRuQ6GJ}^5YTdj9ykWp3lxp84tq4Zfv_B>qS#??njfP? zMaN@K5RXy(%rPb)Y1d8Czb-}752oP>Z0+p0V4*ds_Vvo$L(*N5Wn@MAW!`SG%8%1Q z;Ny7#Aw~S6ntk{y)!<|wFf0afmWJ_{fGuU|XghwzjV!kkxq1jXdyHC^RV$3ns8Zf0|d|tg@tM;?s-16u5|F$>#tFSS7+Onz@Qi-pKRX zCyNhH6l=b{+lrZfZQlGbY+--lbL0cbg)F6wo0im6bNu170FSkgsedLK!Kro3+B)YZ zPiW1!Tys)=nJ7-U{9zSaoWxjEBx9qW9pcT5!r1%9$HqRMZ0YXl$)~N6vU6m+Z6)>WJ3 zE#!8sRHB|(d-Rp<*c+s;yu^Fuhv*q~^!%}+H;5AkxIk?vJE-OME z+SkrZmGY)Si%kyfReBzQ@4g`=FJ?KI3W35lQf$=7Q)T$rOYANW_CHiI0OGwveA*TO ziAU3A<)V2WZK!5Wgbon zLwsz{p;*C4v$ZPJGv{KI37q3wlNqxGkAV*#!V&%hz6yZ9sM?B!4VS>O|e&1_x{Kj~H zRPdqyO;Wz!=L71*oHuGLKj%O@zraO3;z=rdu!$;s7dw(CmOQBr`_X;(ByS<8-VyeW zFA74+ae&)6^2L%Ftoyne;qhais1qSd>3l0`C|3QbYImk8*#nPTNVT*wswyJ>qD(40 zACiX}Y&=)(tm`rasn)xs*T79HVv9A^qhCcW^PMLL!~dC zHir`@KbuNm>!~(=rqmT=Bi#+J{NlQQ7I9# zB_JFF$@MfgVU)B6Cz@|hvnB@n-{Hq>Cs+lK*mcQ-AM}<#K%EipL;9o0D4w=sy#v%^ zC6$1B%EPSlCc!sCCW(qsoi#{!mdFEl?Xz(SOc(9Rm%`v)Zf@Vsh}hrn{h-q z=pabXF4KxEsMRGN>A}N_t`HuFPX6;!`@vo)Fnx16`)DCf1x4d(cczhd)ev&8E5 zA}~Hpc}2c~62ZMrEcW7QSAY=>;>;%woaqaIgo}t#pw429*o&0Stmkl5Xr`6l!C7d zPSqLZ;2+n=gjiNW3h_T4P)>oDa*YC_fMbzqo0pKYVGuerfjgdd!=n>y$FCN;lKWwE$K z|Bd7%x<9cqDU)eynByO6?wS#Gu@5e)XXk$9g&{D*iXA*@@!4%h@y_vQqmoNWRTepY%<@^-xK22xwJZV@$kH(-S?baI@K=!er zd$9t`TIy78s01+SW@kPa-Ja3f>RM(`D5eR=7NhHxes)=g6G7+HbozF3fyv30j>PS8 z#o(tFaq4F3?*xPRm#1}}p?P~Yz8u7n_;^ex<nz29sh4;@Sk>r`%#_2Xo}r9nbd>#EADMpRa%NvST^0gsI08)um;H)=qn9-(p!3cG395h}Ngbv|B7`qd^&?89i47kn6D{h0m!;P$E zum8;_uL*c~$&uf`YTL7VwZgbU%la(VFM{wF3<3H9MMIT}CN z(BMmjjfS<|rKc~(Ld#bXtYz#Gbebb7M$akN`6BERlZ+$;O>JPe3v0jiA5457bT|ug z7pD4NTochRe@u7G8Q5suJ23K0zcDB0NU48iTc&Y!F0)cDO_B}?Z}zBl;c#I^2aURj z{Yp84Pjc$HX-;`65k3#(UId}Ovi)f;$F0y%L%<;tWdRXeU=uH04?lM^wtl)oFla%T z_6ZF0D$^cE>tHOiHPdu={aD|;=p#wMKeg+QY99hma@ z2_GF@eW?(_8r`EIWOrDg%T2GceHjD^U;kCz%7$eL)o7hwQ*WS@RA!;--tcD1FXg3j zXx-BD|2+N@g&GSR?ckICg=f#DF5UFv<5SMrzWij&yD>1@ekA?5-Q@i*BX$mC843)# zDQod3d;r3;xf@m1A^9HX~^HKwialwvoQY2Vv6_khrmg)ziNnh!Z z=c6hUFzwv)32W2No9;0VGLxA38O&?hWznW3;Ye_p6a1qgSrgl3ntC;9P=zY&1rezx zTnOJNI_j6Hm&WY;q)GQPfG$`vpU48OmWOMRMb;m^hR%HTP<0(h;l|d5P1SbCJ`1BA zOL$dmn1XpP4@aZXNZu6Qwa}RlZyi-6+&3gM%H7v=70S)Dm^ul)aIZb-rT@|Gzwmvu z$fDCR7!L7&DM3&zY8v=(;!);pTEoS|*ynD%937ngxW8jB&i3>d%af@_pLw#uDwx*y zQ#4;^{y=)DjTeT|!-)|d#bBCBJEf3z5`E_;^VLp2UM<9)FP;pdN$F7bPjgBL#P+hl z=gT}-jnIa^J{x!vzn;dBs@M1t8!GJ|`q{U>bzbyHEl+;7DC;12+)}IU+W2q*xumy~ z_2-|wbnEPL4inv7b4$6W325N?w^6sQ1E#%PC~XSx_K|f(W5XD%OFvEj%wXFKU`UvW zD`9+D4R_m!W;!i!^_F6b_27_btNHKHdvN%2fxbcF-*y^b>sqjO7qb2#(qmCG=&ZPC z;Sza9;$>0Mc!O)6_MXqTgQ}5(wAUrMV&^0nvO$*p*VF&_AHg%(&oHQ$3Rb(BzK?L} z__su!1>&hx{;MLqjl;oJHiqc_I_up_8S-Snp%Ibr$B2a$Q?B-KK&#l$yzXuwlQI$| z40NgPY403Fn_BKhYTzd_R+XVqECyizF`%`l>qh z7FI>nA#tif&?V#t4cr4nNf2~ch_fWz^n}Xv1ZGW4QO`l0jCsYARNZF+%){`HSWv|g z3I6GMn*zuaKiQWK-f#0njzSc7KHl-iLOj#L=?FAkg7l=Kj(6^_;Qt2Higzb2RC0e- z`bzG_RxTG4Ew?E!Exl{nfh=sWe|XWO`$O5Z{a`8Ps&}0(O2DKU4c@=8v7C`EEUs;yW{{-e46Y2M7SykVvG}b8yj;~EtI^-onYu`!? zDaZoNtc@T62J&`=f*OT4lg2n;Q)`ONAUeliFYMltA&`?q@RDABVpb&l*IR}Zu+-k$ z0NoSA<3Q<^MJ0_9MRK)qeP7$Iu^owF67&-Psn!-$0?;V7Yyk-}p4}Onb&ic9i3`SH z*Yp;+d+J$zKWtkw&~l}NKF=?{C#0MQv;YZsCyDBhnMJ{aI?v*2!C-SY#(&n|W$&)m ze}8deDidw`nWB)tof0dC+@_d&?B&(b2$xcC|g5zI#FPX6zT-UO&&yT*6% zf~ZPdbti*aW8AA)%jcU8UMBMI(M5*ta>-1CQV$QO+LN;jAkz_hhg|j{EBmu~pg;8X z_R$Dg2TXhL(b$2$5U|RCim!=d3A!)VJ5D(W7Q2XC@&v~TcZCYor-L?k3VEnUvN>|k zTuf^j5}k^wSz@gbRVXSQ$a@n2GZAP-myDr5Mu{e3cIdx32KRWxnaT#U2`j;T z2$u*}EE? z24By{ConDJA8E)l(xhaGX^T%?p!t!Ev*($=AiYw&All#WpYib5um@Aq{WR7lj>U77hkjEc^y627YzTHXsn1g_`1oZ{3jeg__tj4tvj!6!Bb0vI zy$EX3lP^kdCs&*kk}y^|H0{Ft{UXL)iYp*zD{>#lw94pAx9Ml6Dn>`D?JFS@gHQY^ zY(HK1j8F;D8(y0_zL38BJR);bpOBG$>63MnIwS@msec2XbnWdbrHE!3ehAfem{L1 zziF~a7EtBE>m^k+zEQXnnt+Mk-zhC`Hly3M#^W=kv^RR8biMe^$IcLz&}fvKfGH2D z8n$LfOZ30N;cuSzXsLd=;6O{HNa=lmlj4pZ`vMd`4`u)nloSJq ztcchU+N8n^Y=Yj3bNA9S>$v(rh_Sj0VGBGS7woObgFCn8ksPhFuXM`tSM>MWQde@l zwO|G-C$9O**&6#42-R- zk8i!);A-$#ig7i;5x~$U{^nV3!!Ll?1*{+51UtImR{1HtD

Ss4n6@Di4b zqsNcLM2T-Mvd_{Hz6H#lV2dsf0jRrb*q8;VZ_Ysf<7>4|rL^ZQ>-qs%^}U<}wq`fr!3DQT!UyFszT&|mTP$)k*Ifbc$qM@wOKmynzPOje#ifcPM1jXF@0C`_Rh?` zgwn*zxsaa2sdU1EK!~jv`EzIq>!jsyHC&4+$=Mlp`@zO$)aO7$y7q+}P0G+phxO>= zANCUZ`v`m;@*m!j+HfKA@;(xl*)zE#b^>8EB2@f~+>L@ZE86c$HS|AyB~Elt2IQm64A3;ddAB$333_SI#O z5-~dykPNOkc1VL0kRH=()x-D1jJ)rhPr}&TH@ILGAvQ{^!i%`VdjEFw43fmv7v)f~ zs@|9l{!at#{6?#@1B8}gK(N3S1$Qhr6Gy?*bhTN~|Cm~vq5aYE{1?;u$(eWCQ@7E* zYA#`nhn&ahn~ui*w$o&RjV`D|ws2bK^K(vW+-AW<+;}E(YFF=Y#Ciq$0oz2AWl9j_ zo=ak#?{7%R4l$OKdtTdjA5r=llZ}r{XycOaf5Xvhl%4J^ieQk$)u!=hcJw12^4hme z^oX-l`DJBY6Z9XDa`^{!w-b{D%>P%ET$nhD#3;H5Cuf}pJ^jL+3q^tVB%KB62D6Yp z;QI32Tx%UD2(z*e0WP z`v_<4ZKl(r6{1PAtLD(0(eHkwkzlpcSIyhtT>3Ab?<$NaWxZy!H^ z^@GpQdoak2t&8Sgqv%#f|r*E7#bYw8VLPY=@nR#3$Yt*4KxjvvEoPRv3e z_7xrFI~L@uQ)d$@QFw%19-?^@Nmiihe)@+=5?Zyyxq9Tx=VO_ae$c#e&{Cgod~rJrp*T0_KEnnGA>E zmT%QHT%_UoYH&9GP#GE8i_m!dsV@^+6uzkXOM= zL_M2&a2$fMoju)$O$uIkaMTxBBF{1}_(bt0y3F#7xyRW}=cRn(^(1|hV|6}3w!;JA z&-F#@A9kI|KY=JPI^rJ-r9oX{;y>{YXj`d!449kUEPl*y3gbJt0MzlIPahK4K@{^|L_+LE&X@dgg;IevULTAcd;NN=;@Y4oQVU7uB`rP%-FB$LR)J?!1J zrU4IDLIzDFDJ(1Qf~QCz4R_?G`tx*)koWK{EvX~EG{x5k9HHO z3kG>}cO?@)+$$d{tDWZ#8Z3UU@4TKUvHujvD7&fFR#_#YbWD8ys;3&xj1KQc z0!JNFK@i4($2dQDLX~iJ_WWAcH{p>LCh?pFkNmBZfBXH`{uAy6y&;xwDNqW?YKMg8 z?GRGy0Uo*Ab!&Om^qE>cBqf$Ys#!g({{w7Tt?_r~sXF3*msOd;5e9{+5%{P+p7nd- zYpmZ+#w|xQLg2TxAXPc=oulw|bmgDqQ7d&YNXQZ2PTVyQEr|L~@BY5%4aJ8u2N%(3 zDYb;ur#Ls%cQ`3@PtH5i{k*+4}*6q(q)r!h1A2kx~tCI}}}f;Fz@_ z`KQ)72T^Z|9D0E=o_+W+`1ae4MHsqFT*}OC5hOl8U1}(&*kj}&3wPPzMDGqnK{ij3 zdk&+fPe$tfPa5Unn5S}Z3FTxGaYY2RhV*{c29_O%?R?D?KK1P_@m+*8Do~tx7ZqM1a}oUfpQto9L&*J zTyGm^I#II2=J7>DKSlC=dL}lQ&R3u1N%ymSjPXLO3dLt|4&j>@rt7G`6=8j|Z_QOC zn;BcMi7U1uIfQWH)JV`?FF8yS*Z$PLDxatb5PEQwd@Qkpyl|U0$H{VY&xPLO*072d zCqW&Rf+kcL<(t@g?WNYFlHXeH^UgTf`;>}KIk+c^hR&Yr$C*#a2ksow8xqdcu>diX z*QSLBlH)q9o?9u-BGu*+LP9!16iJRAV&-Y{Le)Qz1C%CYR)joBz~W?`od(jBKV*p+ zrz7MIraOD4fRO)X`E+?0IG&o8OqzXG^z1|TnQ%D~q0!btf(|$9x3Gee z+lY{&gIjGuJ^`L&(~o#ZWjdJl#MXpd?53~{5#-!P01Ejv)<=O|;!f^K`s@^!M6Mo}G)K27SFrk1RlqbgK$oo{Ml^pO#J zpjDPN<|pPIeE6U0$i42dXx0zt%W^oOR)c*8q=)_AHkg489VXbJwbvKIlpjd4f|r+s^(MMMcvJ#!u?agN3Zn4sy4(98v#k5} zBo0`76j2@1s`g7flf55eq4VXAuFTdgD-aE) zu?L-)HC633OFGuXCe%eZx9vZ`8&j+0`&FlpY_^kO1$O}{(6d-2DC8lRY6krmW$>nU3h$G0S;WT*Z44pNlssL@LRc1u;Ta zv{99hr!2hR5CPY>fiVp5Jfc8_DY~Fne^4f+om=@K!~G_N^Lp8Z(qbNVgVEsX*_u@* z{q|{rI}`h6kj4Hwdgh5 z<-`=F2uYG@l&$e4QSDYwBmoU2l>+=0IaDV%Y1t)m>1IRT{%kg(Fd$^r%kb(hF5osK zf1x}l>Akmt0=CIHwaL!zu14c*xWiNlS%c*vl@P2AW-q0s!1XYMa=74MGcEJ>=kN20 z$8^AOx13#)*hj++U&NjaH8Q|~rWNr7%ff5=q>|$ywx~0fdv1qAI*0f7(A5DAdWp&oeN}4wya7kC2r}u!Rl~mrG5T4@%3Sx(lbahD+e`O}ckVHpKEc zUTFqMw%%vFr=YBje{81`&r#A-%&fvkKWP*d32}Kr z3NzP{P8!x2tHRwu-(6fh(LaC9Ug*``o`-tVigUD?)w;dk!2EZFUG$91 zj@-INtDzfO6At3#i_1WMPFCtlcuztgfIF#wlEOHf32@?bsTJWvA;31ma(Qe{FxpE zz0OL<1!7Rdl3UhvldmR82@GB|OlMY4Zh6(&7Q zvR99CFB3Az#|TIf?ruNcd>u ze8O9CfAWyN&3DR_W7he!7cF=9hiC?3PZpY1F=u{bHHq_d(6a`Y&Enlxt(eBd_=b|^ zjj+fve$QDdMh>MfAEJ9m%v$J@Oxarg5yI(|&Pq-_Zo6D1{BFdvhhwQs6>}eD$n_>D zQpvdRP{7(arK!?LKXkX^T0>pb>^aZg|imJ;jHW@9qB1=of8MVdA4+<^7Mo8^rrV!)~MLlo;9;TRaSBe+?S zAvvwRS5NJGxv9V^0`I@w=rVHTV$|Zu zv{43*sYVGAO+S?VV$sSm#NO1CJ!WWy`7@uWlI|2zpTfH2H<4w7N^iC*gE~xbR^8vI zdDhq(YhxR~3@KdyTgq#cD9y5w)KFVG6v((&*YdUj6zEkd5C3?DAm0~1aSA+eLw2mv z$txdj*dXASaUDDSHScoqK0L_!u~yPNA>!nEg@}mhT$kzC`5QqFS>W;4VgSeI{Q>V8cZ#WJ0niRBX&XYZ#8#_(iF^ z5&U~?Kk{yqCth6U{wFZpkhwc-t-Z(M&1K+O${AfNKI3Y#*hY$W&k^=68wnA$y9T$6~^(QcWH9rg!BV9T>PfDf-&Fi7`JHyx?I)7tAiEgsa#Q8ikeiEQy ze7}%G-B7X>Om$A`X<-fa_LNA*oU6;i2YZ7QfU1`0hu2`V-$uFLizT{*Us2{KMhJHH zmAbva<9A-6GPk&-mIcSPhJ60-c=6A+E)IUX60Pn6JPhhw5QO+AAaj_1sHgli2 z*SE!VYpoKtt&Vcolg2sd_*0t%4`q5WnYty_7mEk$r|jw?IStafWBcZ;XIK=gV;QP{ zROa)~lGL(xrJFTITXl&VW%2k(1zXkUCDJN(3yp&c6DgELG&oebuUKRl*nN#ap3R|m zrA4s=wQ{$+g8@uHZaUYQa{^OWW0~a7wC8ar6H*>nB|VR+JMNT;zIZ)DW32x7sYgyA zL}pJaA;DW^pZRp!`KPDRheCZ?!&-*fNpLVzh?$h?aS2yV?G8n-ik)V>u!tIUhn;GV zuGt4GCGrKke`bk?@w&&0rHZ-{R#`;D9XkB3dm~^3J4Kyq-4Nid^p-s9U@8KpUpEHE z7(#Q~+$I8nD^K$^vB-N&flpTI-85-W;u=M16N@r2@at;@K}O?e#NkGouD)1Kx%MX4 zP|HHCK+(%r#;u0nJ6B5FOXABn8Q7M`muKeG>0bZ`+5so0)K6x#{6ju4nhOWDXyOKo zwIBR)*;#YO|5WO;jDq-qjzzzGZy4*e^s>=UN?657E?^Lx{AnVSjt~vVk*Imb@H8D? z$21wU9|T4NNU(}o7$*S(!=0Y@`C~f``5>Z+n$-^KmeE2cx<4E2ulP(=-l%!7Zsqr2 zZWyUuMZ-^YH|O7z=)=EV4HECM0@Ff$qew{4?KloPDY^5nKIPB%AGjACfhzQ2ds@GY zYzO!BC1+8G@znLHh-Y}iKH2UqLlPBk-s^G3(f%Lq8%lZaN^(vDB2)Rxt6zV?lo-kSy>&;DpLW#CzG+c8_O=)^)c zJ!h5gQ>#UdEW=Hn&;iB^LBFTDkL|G)x%9qL(~cECu<41WxA_H0BO`x0H-%R^@Qot~ zCr32h7H@;aSNlEB&+||WwXmC5QgAx~K~wy;s2TAu_rN^KL)5euTsNmH{#(jab1(6| zDLwxortxzYg8}JJWB%E3mBt*^Dk?kL5KETAd}2db1!t^Ynw8D3jA;EVOQ%R}1P&3& z@YwocO>x;vA3!s3+92k*zeS^7g_YV1JXSB zdG~^44o0x*MOEuxUTS)aWJn~$D{}lh$Y<_g>A?F~lnFR3iCSL+~%6xl|o*Z?Kym_6`agU_e*`>M?Kht4{F1@5yM zStqTOba^>}Lk-COFeEZJNh5)<%()SG&3FQg&zzg8J@QuPB7^K1QYFjO*`c^%rquEA z`%65oSEvoLOer@$p{mNmlIo-xN2wceh3~aQcq^-XRZ{dD6a4d}QCj2HYuVOOpRThh zo+0)xJ|r(hB|`AF*^W5x$E{fE7#JA-WZZi?+L0bQ(4a_KRXv0(3DUl=jrXfAs(U>g^x zKZ6aPB+R_9nmf=99FP?B0*tki(N4k${~3Yx!%QB7^oFF2WZt$VbkdLv=CUQ5N?K-Q z@=-aBDbyvJ8Eveg4DUw{4NNtL%ddMCH5 zWfYlgoLzy&`O87ssl6Z2&iAK>H*z7!>f3;Z*8VU#iYmuP4IwJ~ny|O1LlSIzY2o%O z?an1jUOonlE-B-LdV#rPE*`z*?sEkFJwnmdtlDPabVoFaNUNi!U-}$dtz_r#UzM%a z$5pIxzs(Eu;gkrC9^b7hy|jG#tu-v3_|g(`Abw&Q`2A*jClVr(5)PqWs%?9D6^GWL zkz9H_pSZR~8@}tWK=li=X#VX52bzowx2hZAQ3!Q08&%9Wu*n4IffG~j60Z7XEuJ`- zFY#H4r-g3b#6K|G--&T4$_e_rmVS#r;Q%<9(IN+{CM{$V4#w&dX{vzn6iz##O;8U% zL>URbeunhWwq2qq*?22z1^JU5;w`(b zIwEk5_X4XDLSGe43&qWw%=lb&y_dPVDrW;+^FbGjC!)t$>luVA)<`Ka$y?=zq4F<% zO87isw_vwtXgs_F!OpqPIT}bW}okr%F z->c;+&J>Rn=Uxhgj}Sv_=+l>PUYiz6@RgLOCS!bA&bhYQa#iP-iKsM|{a)ajL3v!I z_IRJc%tSpz{&+)RZN@Huj9;R}U9W z`UdIoHT`hjexgsdaAB-mp|5=C<2`}*sT|t8x}!ZDlD;{sMI%`qB~B_*v>Zz9B<9YO zWc8fY2@=+d^dKA9DZoKz+8JKSd9%6it1dhi=OhF|7|@i8mwaw2Q94}s;66|0Ba=A9 z(@pd?Rnf$VYoh2{XlpK7Bw9Gp>IdeN)CACX_*&yB%A=P*@)gQxUR84g1MDZ?SysB- zrYJufrdso8@djJS$X8d0u`b`4M*u#gZ!28wA?Etqthqlnv;{_QRCf6L2j(q?gjev| z1ur9If3(!Jli>kAlg1O)S(jGX`fO{`eDfpuMsx77uxXpulQ%CZk%4IAG_>f-Qw(6+c_`e)B1C%lS)OvJdIAprJjy!{Q zzdIWLL9|D8)bgykKK6czM$8%*?J8O;53jeV(;WT@O~Moi+9#SF)t#D+g@+1LJn85y znq2tqOPHOr*0TWmoG$tn;o-@Mg6H{nMNpA6e8X?_ozD6ft#&OYoU047HL$$+-QUw=x;@a2CUCXG{| z8tYt0kKKfOsp)dD!85jl#23FhwkkiDt*nVuAGfiS6@#|MO@{tskU7v3YF5u&s(xr8yB4SEcM{w&<7`)&w*)@gN!Z@)%rZSS zEjg43aUP4%whCut3#dJLY^~>d=WSV?lZ=aA@m;_1?Y?9|Fhp7kaVj9_`#q z&PyuN!IZ!0_J1j9a&DM>iwY!O{Sg^CD`ujr{s|${>VyUSo`EYX-eZFGOI-G_HW#dC zpWzJ+$+}oHB;1A?Y1&`b1_HHSMw}X}YFqzP;@>_@UTpZ?bR%07;l#%YWbclB?LUTKuT35r#Gh@ER1nuz&& zJ>2yW75AJgtIaK`{=Yy_1)aWZvP;1>8*y_eJ}fr2IIjcdV|fLSh;@L?(w}!`{e5@n%VI-n zIuV*FLG9CD3SR~S7K1{|4-8Zl0@Mw?530`fy5PA|dSXD@+lW1^JerKGXj=4^C}7U# zlvT5~252y3A{k`hE?0d@^PP}6|4+ZV5&Jv@=jnn;g_fVt&4Z!==M_Ze?>E2#Y02qb z7*P&W2ARGd;y%xgGHbcfkcJJ5im)d`8I0_ophg~1a{qyZPkAIG;Te!ss$U7v_0(7n zAhHuKVzK)2b29YK@#jvSI>T}>ta+hTNP1-ZUQ_n&XcqJ>No4G5W5U0}^moQt`NSfG z$}@>s!xm^&J?501?`*i=p294iynC&cTzisQ5QcI=*YzBi`plX|^(S*KTqf>6mW5}1f>qcL0hSLSwlSAPEco{{|L+%J z)S}S{ILqKp-wkkr{$4E?78XtbJ-Y3%v>UFxLXP$^{qQs8>=OyE>Uj2O|4Jhf>Qu^p zE9Ers68_zu-r{pc9N8!A6TZJ5Xlj>aUC<_)o#U?BeNBVtoNQ6R3%d!JD|U1^MD9L~JCi3gu5nZKbBH8g zpbFn`ogL%*5s-REh2@^F0fYkpt@F~Wp<`=dze=5#>PtU@?Q@F&>W;lpk&bw@{wO}EU(>J2-{EiCuSp+-tANZ(muwHaqph0!vn%H+1Ev6$34i;fVN<8G0 zPWHlelo$o_J5Gfa)msrQ6A(EhI-J`GEzZDB-u39}Fy=({OTh{Vcz8{nWFH=-jPOw1wa6ZggH%b!f3xA7h>U-vC77RnZhM(VhS zIR=-3kPbUy+yv)l10vgGFVy~KwMrz~kz?HSW3H+NvK1eGvC!Nim(S_?Qo~&#(#9OZKu$Lo)tH(pd&X)qP!D1W`ah>F$v3 zk_PFL?jCvukZz<)TDkB%xcfXE#HU25zz$t~UIVOztD@1=F>xiz*raIplYR|TlYwNte)xB8rha|F3 zbq2J@&q$+{gmjtkoGleY-QO&KI3l_b>Kcp^BsIA zUHgz@jaYI4LQMqYF};%^Cbg$Bz2qB<{XY3tY|Sk4J*mV;+x8n9tq;FauK&buC5S3uHKa;Ks0?^gd=OMG-5Y}tp#i3JYWSF-Jie`4hG3SP|nM6A6h z5MlUcbIZ?09moY}7+%l9e%Oi(a3e22bEbg{lB65~^76|Y5qPaE$lqEd6{1->RC#Fs z+FFw@Y~Z_r(SEmdwgKyv%wngneSdEYYD4%Z0`K3HDHv~`hxOu+yF_wWAH5q(Z!O*}w zqQ2e#zJ0W5Q;syMf)9hp#k%t$F}poK^J0!LtHrZl92kfJM>WRu=Rv^s+hiwb(*pzN zq+REJZMqGjy$x&}zQ^1Up)$$0Y(@ut_~0gHyHw|v&7nRLbN|AZbw!2US zZ=!vMqTPUG{op#2jk*F+ec@xZCapiK57fDg6N~EnXA5BwuoYuZoHxB0Qcz^ z(@;#ic`e-riDnZ)2K)eosle|a8UlYeVoojJv4y*pTl&9(uO<+OZFL&VQ}tPz?XDsp zUB85Vnfg_Z^eqe%^^LIB5Y?}ZjduWY7Pn`9^MytwAt!H5CSZK5ZT6qu8niq5t!ybs z8eFfp*UeWy?}5>gyb{6S?M~>u5d7UnNgqT{*PG73H81D@ljBqrFDX8)(WS;?Y%X{f zM!{X0d_7;5Y{;-Uj{b^r(mVS`Gs%3uiMtBfr}`5+n!GF~H`R{zBg?kFpCSykm4n&0 zzd|wMv|TwZ87!*!GN!>xz4%voG8r0TFg+s2OMM2oqgU&RrR`UO7IdgIeRi;T=MfAD za}AAMgFAI-2)7__FQrb!{6wmr$%IO-gh2~@g{99wlT z;1O;AGIH692?u%)Hs%N6;2r?0N70b;pTQ)y&wqDjqwI&`Z0DrFWmZmV!CrrV8hfn9 z7pKsR1FoJ{5t$Koe#wm@;l6nbMd(6Rla@+mml64bPMp@W@_&+ zb}xBPUI?_&PpJN)i9+VTLjM(PJ9qwZ!@U6{y1YySA<&Fl=*QE3Bno-(RQFOC$zEkF zHjG=3vYG4>;auFYT9T@%q4!8ikfj#`4-!5JV}hdTrieAraV_fz0y5}5atpc??_YIXA7;FJy-phg$k{?14r>2XQV>< z*zEd7yrS_n0hhm5!YUK|(aeo*Xo+U7R5fSnh|$I0yTNx@>n&0heNg{boJEOhzG8mR zbk4p|EEOT|POnbV*UEOGKB6ZVrtPGwjH!W78LuD0wW=C&hcAV1&RsTUme3QLz4@wK zU0)He%Pbu|Gf~~4VzI@9?D_~V028DTw0{Dua+IF4L;Wf4gdX;(n~kOK2Vbi=2x$M938`gg z4F{vvAisJ^GPVY;L?L>!(596`MPm9}EcMCMO_Q(3TKyX@x_HSx;rbWHDYv#byW{Cx zWvZ8{_yEHP1LFWIl$mE;sr;qzW|1#4DBoS#1q>SlbK*W;KBr|(vfdDR8hpXLGfvm} zP$_gS8c56Wu95~y*}wt#ZzH$zgH<@ZszqsW_q0CG2}UCD;DRaL4_+9R<&rYfCau94 z&dVSQ6r~}bv37rOnvvTqBU{wyx<)ri*5Ep!q{1NXl}WY|heH zgp@K+TUo;UAmgKhuKba;IeW$v&Z7YKY8s6 z!75x9Jq+!mE|yDk#dld+3Fx5YYic>xA^K6XHw&Osg8Mojx^S7^_+-uCZ`53Ww6i4a z_MD*leSrfX<0qD1$DuMvcwPnnIYzo&Eqmm=UooY0?o&9v#9e_1EsveFlh?H!9wk9& zM(*&6rD`5ZMW1rp*MGL}g|@e@bQ~77|0`-gDr&#Sizm!jAQ@?Asw&U2@XKm#^r2XRQ z$5qhL@t&)<*N=Fil@(KG?F_{4;+Xr$`~3Sfpf;w6JqCK?`*Qk5usO#Jd;Pr;N}f0` z^q)|8++Ca7Ki)A932?jq+uk1)Wpvtgyz*Vo#B zT{?)VD`W|4Axo^Y3Do`@t9t*Bz-B@ArQCFaVwm5MsnYR@fVX&C#n zy!gn|?D=Q|-?qU{eq3y+B-b%jlAfrO8>+z1F{&J{F|Us3j0>ou{g>!UF}LFW`Xwj` zwT^PjFQbZcSAZu`Q-5hxQnx98r)HwWYO^Qa@9rRwN46{vfY;5W(2s?deL+WqWb4%G zlFLo|xWJ%&l5zR;Tt81O$1;=Ys)d0(!gbb03A}~vb!f;8pQObt4&c7vB5?5YbN|cy zmk8@;G3ah*oN=LGqMaxuN5*;V1(}NCPvk0N=z}fKvhbOr*9lSg&qLJ$s%*f{){#kE z6+-%)e}r6m;$)3j!UwrQTiGzHT@yb;`YjKQF02?$4^hsngHE=JKP~a$b%qdp3q>ta zsILjqzQXf-_W)N+YUA4gmSrcg&_1MK!g@gMVo`kJb!i_c zQ}xMf{qVB3eLjfU92W6!?$Ke7Q3b`R?)OhM`8WKHMY{Z;wD%v&bUQFZYM#O6#D&W& z8%%~L&bS@`QoB#mqgl@7ASeeP&kFV)vR?}^>?1yfG z4mAm{A<_>%`{5Z6tf_(JsSBoSm$B`xVw`mvh3%bFU6yT{kgjl26j%}LCcz%s@v_&!Qo2=%xw5KDUzzd8nNZev^W(*!TZFUp(V(DfHKj6aB(R}cJdzOpL>hdxVI#?Kx(=n57Hc|E z0NhpY*p+a*68^sSw`eM|Zc* zJ}(QTNs}ArH9!CGAd%QLXO?;LTQn~-&YRGX=8tk|5&@sptNh4ggG66Fuw9Wj(f_RO z^tp~0aC4@$OxtVPSNl|?bV@**mnKnjP3+GEXd-t~OwX8Oz%7}>UUH45$1jd1+w%yw zY&}I0BFjNvFivpkdoHDo?7{)M4K}MRE4~a&F7G$+F?up2SwgF>d#|lWbmt?2AI96p z5)(BZvp@)ensbQ^w~eivaL~}bCz*Oj%&{OZ7Af7N9NlaC-!ZRE@XQ6 zawjDTVi37TRYi0tVY9kQ%04K&-D(i_o>ty&->cv4?1%0oLjf488aSo{L~bEauaZTwn1Rwo3M{{@kxSr*y83YcGyJ?h4Ns9f z-0q?JFJEX5bBzfzCScD#KtQgD#Bo>XLqhwnf@x!5yg=a8?*8e5$S5>URmBxBI+We=o^ zKtmKVOiIAf*MSYuhF0s2WH`8GSoHJVmpT3uH_-k!Rg*K$7tA8qhC z3Jea^2NVgpc6uGLK#1U5r(HSt;KBr2C~|!u{ui>kKUaKvpA={sXGuy1?jTtIrmQv0u>Oe|!>TpVjKaVzC98ptMRKMfe;cxaw~#s1mA!WXSV? zlo7$oB8U>*?B<|8xsm3qS>qTfQ?(k?z;aiqEk>j(-0oF((*kcwJx(Y`>caE29bRsf z7UFweU(qJwGw9;l_4VoImJkTaJO$QrRM5N{&oF!2*0_OoOFbkQ8Q+FUH26| z3jM*w0q3+`DN8|aDjk5F$D;9w)P_>LP0~G6-ow$$0s2(L*MtO|MRl^~8#wU;GRNlD zQrEEGN@5H+@zAmv^?{j@$CA$_x3V$DeU~iU@Z&MhNlv-?Cfo|b5?X|h13TVso>k;) z;XtZqkbztjSxIi%4Fms;8JUgK71Sy%l;Sq8bDI=MSW(Wg#|x ze>A{)=^ZK&o^wyjlUd`napNOpyKAE4Jn3lQfF%qexKb%MmqMEfLJo|;>cCI04Dplf zl2uOG1XGqMa=P=rm9laoIycTgNj0L<_Ot_`@#Vz+_}8n+yKV}?exqKz(fV{yWTLsj z$pY<|Yxd;7!FmoXwCQZz!EY?CSUCO6@A#tBXQ`jF&PGr#{U}~-c9Ov5`(2jmDL>YA z&ml7cgXLqEK0J--v?pAIJ*&SXN-TTaA7|`1WK?STJR(R0z60IS$AD)Xo~kMs1hy60ze1%?v&D3))MUK$7{y7J2i4YBa8aJGaU4+!2eww&dKr}HY3yVK%(J4j zj7TX(jz-DXjI0&ej(K&SMW0WzohC|<2UV&7qc3lv0=cM#bd0E7rzN;M!{TZ&VDvUz zIAcO+WgF{ZZOP|1X_DCW8Zb*HZpNMDr6A64m@3j`W0hBq z-{4DMoKTLK&=rJHT7(8&8U!7}i;#gYZLwZl7u<>BaG%r|B>$_9CM{*ZPZBO< zx?hCMwk|E8kAe{OjT6i_v1b21E7jM4UDwWQ{jWR(x8NGySW#z8IvN3N!}uWJUwlQ2 zST} zZ+6cG>j%I_i(C_vM}B*vT~hM8h6&Gi7N8=D93^Gqn-L^4&NczYNBL3^2W)$<^+pbM zcq1)H^za->5QBMVyxOkj8-+SEL zRpNo&6Zzk0tosB@wDDp0{-me|wDCZg$6lSqrWGFdO&KO#%{Y81i;?|ta9l5l1fIU4 z=tWMb7CUjtcLdH82%&f<1PFc!3eGX%$7&&r8sORR7+h0dFRM$At(M|N-cjc)0L46) zoGt=CPCT5fDP<5$h0tnsXwgAA(gzI+IbLUFe@)(5!)WS zHy$hEV!z}0vSdwW=E{D6@o7%$5=HtMe7_G8{fvl(6rO-+UOU<03#n*m66-S@7hjv* zC%SRGAKdV7LGdp$PcJju8h{A?bzWTotZ-!|k~oYAy7*TowLP)n&ip#nihg<@-MNh* zLWg`W1NxP!MQaU&3Zl#on*h+nqviujmo#NHWw+@zGt;^28Ro?ifs_&}VRac5MJG3d zh);cN3=P7H?0l?W=gbis8{11lj8ttH!4aeXG+N~kkoGbKS7V5*g{V3|Jzu`Gcw_z+ z%F`idHb%HtPbsj=q6Dpkva-&YHPAi&$+0TzpgX@Ta1wH@?pXXfHnVqG(Yl+~ZuD(8 z;?L@l50>=-A|x+iEE^L#r`PBC07(OJ^gU{%LT-iyo7kYUITr{XS7-F|KAo))wt} zQ(-7&3P)W7GX{Y2_x&0cFXt19rr}4!{xu2`C(&J}} z1hlo^ZdUz962C=+h?x&0g=Q|SRXR}l#K#kn8h&A)w;lDo#WG@GVsLuM! z$7MzI0aiiM+Ly;X}ZcLv5iCSaJP?sgSed>_TM&bfqw* z>t%y@>*T4PdoSOBaCO*7ycFn;3IIb_CL!yer-gi7@(=E4xM9~<+iIpe)h~UAsuKao z8ZWzP5X}42B=v%@HJvS>h8nbDW0hjFS#jU&GBMm1ExwZa<%f}u>vTspN_teT-b6&4 zxE^Os&-ML)c7*E>B1b^JlA*t(w!d>#h{Po6#n1{fCTQU-^?B<&Bq_jUuurmzz>jATwF? z;Gl#VKf&JRYAd;E<`>7kE~)MwRS@gr{raph8;Glr%P`Yr+(dN*0ECncrGy3cT&go+ zE0@h&YM}gA?dYgXr5ezlK3&_5@g}E`8wVc1 z#nRkeWo7DD*s3Wln`<7bZ><#+#{Vu$0kVCVS|V08BZEVoV$-~7M#pE>VD z#=fw0Yi8XhHSv}{WTFGML0=5ElKu#Uy<{Y~3B`%}ujf*qJG%mCT;D47jxAHLWGu?Q z^|kkAC1Dc8OqPKSFSlItoUkWL1ArFsPuy5205G(^gP*Hz+V8L`+kAJh@!_y}=`TRvOUX4D-kQ{7-Kp z+|Vu$I{~Bu&#|(6dz%{lE{GM!p86K$wGde^i&IP$4YLlEzFq#=Y6R5w!0WU6Y2YAQWga1gQT~r(}QJlL5bCm$a)_-aVM}iktf+){bHNWOr z1^np3AE6PEPCLsyY6<#C={KBrsu}8SDsNz1wSoAzq5Btd%t7z*!s9^BC>2l^&kPW2 zpI^V0)}{II{i1&+Czepj1+#TONQ6g(S1F3xQsKFhr{5qa9G&k#NB8vvHvsVguCO28 zZB^jjN5M6f>dJhG(Qy$QVHvcd7Wj z4sola?0o@{&~^3pOTF;C-cd8Q3Rqj>*i9enA9qovm*6xl8r`zbhntSAL`VSr_RFlF zN`5C`3DIPBKLu4-W4488agc5G&x?|!sJ-CSnyEo@FqRH}HRnL5k2Wh&glb)C;}Hl;_bJTqt%+GbQwjt8E33Gl|2hGqTyb3Y(&+%X z(nIjK#|8Nw*q@OvHDPQZQ7F9tIY)XfILfEMhz_9~gc6)$T>^B)#=lXk<3)XQiO-6f zh|FrX+09(&fY$YUi zu3jU0L>T-G6#R_f0}doMInTh^BHEfdwMN8iyu9Nfkbm5;wbfcEq2KV}^&VCT>KrQo z96#S67edI@i>M}1>2yOT3A<;jRyx>hgdPA3^zyID*}Z)=dMX&J9s|%!sOQoUyGnz7 zEN#6*Y&)B3iMi!f6HDlUWTUyY2~=z3=eb}39_&g+!{Nmny4L9Xb@QC2D;X+ay@Y~q zt@UiQmW(?}Bs=#*1FVahlEEX0dF%zi;ou_?ZT2hGr0F2$7noodT@J%aZX~d*e)3tT+ zcuklY3em>sIqhE1j{M>(5(cvg;`Bx_6#wz~O&GsEMaVSxSA=v+m5SX+>c@ZJjgp%D)eA>$u_FwymD4`U>Za= zzfp}kDXI2yTWLhzXam`EO6k z94f+1Op7LweMSxeZsAOTK4<{|&uxv6YJy}g+;kluhw4Qav*c}fk}$3@_9o6tz5ZU!8{562*5wR~ z(#ARTYPC*lO1?r?A}0!QKb`27CvhIa9^_}YsMfC*ogJ~FB3#<*uzE(3{V~P#SLMIx zHXyH`vnj#vlL_)-5Fp7!41zsc?;(XgF$Iy7%g&#l`qWq{Ay>^?pQ zWk$b{4=z_xkE!<(a@pDc6c_H%b3I3A_gLvU&EF0pSM3c>&i2wHq70cN_K)aUtSJNs zzF7k=XYPn{MI@}tF;@AdmoP%xZr`ZWY^foZmK4>52V(QQne(2#ns(d~@5k3)@d@a` zr{Q>GS0pl@4wXMpIeO!snJ)cqk(12nYS7d-^$6qTL$Xgh@V)fB?#Xa;hf>bkF(7chFXe*cvYBj>W`|)p$w|UQVEA8%p zDijomU%DKV=!ncf9Y=EVz?}gAt1Gmlq6w4(G4GvTltdjJXMcH_lPyM`TPNsVW%;}5 zG`97$v~pgLXaF@7-11HIUHXAmdJEN>fZWdqEw_sLwpZRP7ztJ#QT>RF>wJMIL6otdQC0gscrz)Q?dC1OfGtS)L zaPg&hdiuD{Fa*Mc&@5n`B zqZ#~I?zv5293BfIx;xnKrtjxpIrq`C%oAyhXi{W5A5x_kx|vtrtqiRTMwCZ9TU6dJ zqniP5e8;}SdASIA-)*YE>)}r~&~&xVv6+f|ZM|gBNT~)h*3|t?1C8f69O#Tm+4w3+ zwGLxm(5+wse$P;_ooc2LfbZ=ZNJc(y^^O2H?xDb)V`l`4#|HF2(7F#qMxt*3s(r)6 z>iEQ4J*!(^L6#2I0`r}bvT~0QLl5OooEA%QH~X;dDbl9xfH?VT(*zLt>&d~P*Zhp?ymYpex6=EVa3Zyi&eLY4Hs`26U)eek)T@+;$?icwfU7axnxGx8e-r!IbGG z?f_o^Uj`)Azv;l!`}ApIwY}Rwck8aJ>Z+ak^U7i<_Sxjl1K!?@m@$qbU#Q9YABSt9 z5LAzo4)P5d52o>WpE1o;o=t{b5bpG1BrQ3B;HDu)PJ=1Yn>aWjQ3b|bExHM|k(+xZ@UaP}DKK8F@t9e72RhL>{ zsjQnj4~Uh;b){nenm0_9?f{^E7anVqZ;6?#DUPyzz1+4IGZY-fCXGiQ-`ZC#Pfsfs zq+Six*09F)6hl8Jyh-{&RY!X62pMJ0CybH6qlv@eXwB%MK^&u};*Z=|dM($R5OT$R z_I*(q&_j0??wA+26bbEudj4^vj&0-4Vkv>y(5))lpK#mQnhLc)6>lPJA*XqKnf@AX0PMn;oK#4YJUi0 zW{MTkBBpgmHf1i$t2ZFfi1}c43x$Qw(Wav-lW|tlYVgD0Sh7dS67v3v(6FbeaXB|j zdj@-YCDbX*A9FfgSwGHVsrdVduikScV&FySXT^>8DNA%8mMD4Y@hB9boXeaO%Fq>c zAOIcjlPq~LMha4^K2L8%@WOL}%xm7M3bPcJ0$Hl(JLAZnfL%5`dZ#PE9-^BH#5*TY z3qQc*km&FrhH=xAUK5Y;vd^*P40HyIN4C};!;PnY%Rkx0lxzdCb2)D=FP_`5g)HqY zUbY=d@#5k)?LV408DuK)>A-Wi;1Z;q@Z+y4H^TiT4wU_x?j_aBI_GKEO%*c1e+aA` zPzQHW*=mU-LgLX=yJD;$O0W*o>30l=yC8BVXPllTAs7{1nCeyk4)Y=aYuE=Kk+M9g z5J>*9EUdk&z43bFa#*n~+koF#x!LrkI-~`P(KOP#<|uPNpKX9}F*6Cr=W!w->Zs#! zwA2U~ERmF%$P;~uZ>DFZ4zl$4D|(7fz6R@qd~_bo&#Nh)EOpldK&Q0Bw;B}b;% zi5p@#et~Zw=#AL&;!C1mKi^`$3y#!i&oD~1Ph=5b=w(36zOQ&zOSbr_N|+!uarwf& zkMm0rSnf*ZXPQ0kYF@-XX9Zby(VTj;Q-gA+)(M@{iF&Lad(HA*sUN_qS?_TLl(e?_5s4l!?4jgKQX?6Whyzw$M@3TU4sY z0=YR!C)1UM;w&YftG36R(|FCXwqPPXa-dBiS`c;E%zdypG%xuy*+JuP9pvTTdM|l> z=b57^0#l(v7Y#Ni{$GcDzee}`J0z1&eLL1TauX+D7w!S`jd=Tb@W>@ksQ7N*mJYMY zTlI`zS$uYj^&!|y75Yj=?7S>m&EkUpO0F}lN3s+c*U29YNHys( z=LH3oAX;fIM9>G_!jVfmKb+#I=udC1odf0r8>TLjm3^?tiwOGT(0A5VYJWY+svY558?yhbsn3!w%@-4VetwZm}`q^MW zFt}+(wms7@7`s>f-3)ygRl*#3fN=JI63M2^UDxu5F$#+c785i)WAG+QV(XxZzWh^fQgZ=kJrG z;2r)#qAAzwJc(Z(K2hm0w1sWHfSdi52{6gL5@0w|jn*kwnRZwA`B5Apcm=khqc3(D z({+%m%$w+K^6a*b`#sO7O3O9V{ftDsc8rW%SSYb$qaNijI8TP^RChP84nw-O`|Q{}hC=ep zobe-d#25W0az$jr_-fz9aecuFViMd?wCb!}b{?d_{>LDapF8$roN?-awl@SVAGzVJ zbzR;tt)mQ^z;ihWO@$;)cVuOTADh9LyM~A?<{}xko2@RXKPj5Y_#t>`uV8yjC74pAwH-~I4pI-*=8#qlPVwH&N0713^x`}le@c?mK-T3}878lrp^sT@ zhsJ}QtTUftPixu>N%4Bs0#%wKZF@2~ljjLuA9bSo{pGYoK4VMC?V&@B5LL53esEoN zJY2Xz9nf1 z28T@{R!hDyRXoExwv`EKV;9vBReU85>;(P44?dxr!#LyhKCe{WPNgh$ z-vbtNJ&X{|JBgX?)xs$DU>&44dQsgm(nwvg)VpGxV&&UAu;k#(9wxjr1GduFLOh}obIpMKACH)qi(t(CMTTb#ojVSzB2k3uN{YOrQUdc=!hDB%w; zmiy=QA@d(zigr+oO@&2Z|Ghkd_u*u|cSHRX8Q7{-CY}=+ot(FiIWJLlcU03}?vm2m zkhG&`b=v5~Z^^71a_*{E(PQHc1-yh3Oy{lPdKnmjX?J@ z6$z{0_ABZ3rh2ogP0rFykz>hq3E!J)SyfXVjn;|$jUt;IaY*=ELL>F04y;f{1apPP ze53{5{T&pMsOWK;avEOVzLGj3V_sIoX&qXSa|$#N-|6tvJ;zvMNf6mO{e_; zGOM0ujvCfoXM`VG){Enat@_BkcnvZ=2IbgahV3_PTyPvX7uh#^K`+Ah;NW8pC9dx( z(>s3raO-V>HqKh*yW^I#eSQwqe7=b2m2k8D5FezuR&kKTQMzc^BglC3X?gONwu&38 z-0W{F{`@(qxRUcJx(brn#abM#Mw}+kW_EeWXTpxmh^|HdRGkvg1GnA7mEx zc6WoO6@nPo{($E^6Wgy*Kjzm*+A9OQGUEC-rKYCl!TA20REw^`$*W2Eps%^kr9@VA z=Z3V4^TUGsIXjHM=#FH2kK8xVw7j{LXru)cULex#!E<4OX)LWPZ#Yp7{{itEyq1Kt zh^pDqsn>^Cv|QWmY7hNN$H9oki&+OMsv$>OUY-p%a4e313`yA6b75{pdSL{X5J2rOgsb)wG1lbZ6X@1fTurXFK!IUG4BTQna16M5fvxK7oU= zS^MGyKOiM+hqjP;#O05*eJSoyj8sd3m=-sCy@`Ih3-y0rhdAX`xht0VR0+ zx|k&fGa2omz+xuDPkyNKZL9*U!U^*gjL`z^hVvCnn~p2Rsj&sq3m8_v;QWvunD}P8 zMX}1g;hAPKp{gh{#m=ljx9ROflGj{(_;;mrEO*Zgu(wYW+>^c#J23^KrQKhOYV-{; zIQv2IU=%`&knkp@^LVhGhyvq>9S4lSx;}ZwfK!*|#x|=ZZ}~-vf8;VB5iEZ=*1{ye zZqO7O&wH6Zup?LJBlM{wvRMruPvrUUtZ$}(433wT#*VeC^rr8ZZ}y0wS_gvxLZyR$ z&J|6 zK%C(-esEcE*So8V7er=p{TQUbp^+a_933q)MgT7<{=FP2wZn#KB}N)dcL>bzi?b^< z3GxO*5|7%Ua`Ig1T#V^MFYTz{w}*aooGU);)~`ladpAqFT=hmtmbgq+j_oAiUpKm? zaueqpw<6X(LpU7m-Y2#kSz~^Gg=ndDGcYID&osvlbIdcIql@FuJc}{&E=`7v$w-2_ z>`A(RlGHtY$gtddt2ocN?|#{tnfYD!@}xO#2F+GF;3^#v6!EbD#KIeO-(jwCw$5@;rT(|JDxmiD7x%vz=T|vB zmYzESrD|!;p`DEk5(@SnuKEJXafI=ufW6-c;n5)Q?87XK7eutjU`yRcAW=0v%a4s} z^G;fZ7Z>yXNe1q0607sZ)2#zv_ms|q*prdR`cK_laVjK-F$TdN>>}rbY^5TBFZ!U# ztOxu+pBdD2dk#vCZLSzcLsbZEfC=uL%4{ox+ErfI%G*pWPQw##7}l5ndC$FHuaDW@ zVHLz?=U&yzj5uQ<6NE>iYsA|@K>nt!Ab(4gkxNbbABv+Bj5v6u7RFQHDtFKp!f2kV zfU7{2{Z2T@I>UBs0|)gesBl-eM^IG7G6gwW^f~x0#s0$Xhgv!peEycnhdq3mM|$l& zotE=+Uz0o0lde+I*3mi(5c#0nME~If;MCt0F^MxDyvDDns9oS7VqPX#H+?VkzA}KQWObKDJ%+o1C0uBu>}eVV91O3O+6u*Xr+=l67Ed zBewLaBha1B9*8{qjWhS_MQ{W@$`6+AvP~GLk}**+s(w+;ZAmjsoEiYX0k$=`LM zYEwKF&YRzv77ZP;;|o(sH!mb0x~F0zQQ(<>N|pb{@4N(E8bE-rY%X(R$2Hm}EY^A? z@*(ZKST|sN+OD+4Zai1Is&5GjdT*oMKd<)Zl7Dp)d*G)r*AY%a6 z2hALYIhP=Sr99I)2#@t8Uqx+t9na;J?OH?sJYY6wgQ^m$#tI88jzGR_AtoE|OHNv4G zy-CQaWK6)Ll%m~2x6cYUqpEe1W~N1y7SvA&qg;8N?rLc_z25?k&-?RiMy`LXaP`?Q zY{L*N?;-Njidoms(YrM&uaDK<20eG6eh216m6ez;f(djC%lj1=LFsemj)sZm3`YU1 zk8Kqwx>HHY9^WQ8eQ&*as^_q%nY>8J>Hf)DPrUeB9ak>qAYY)S3FjnXB&NB;`kj{&>qm|200>Zv&Kn3^%d?TEyNlOYUNE z<)IM*Pa?q;Fim_`lB*!4l3AvQaZig_KEZnl$c#hIkcMvEtU5y#-dR)6GIt~I;YNEn zQ-U0R3ja;J1(YKwTE%%p;(JlN!khOkm;t~IC#MtGz23w zu;Rs6<|*0>_vxYMc&@XigI*kZU5to4G-sFSISNI!>u4-knH3T4nK<5%Z=<;@NJ9NA zNM;)k07XGN1WlkFtu!EV{(GmQFymtV+Qj+sL^E2{Ue-dU(V`Ba=hYPzg*P}Z1G`(+ z`=o!kX)N@ci{Mqb;(PU(Sl94UE5e~OBTrLbJ?~$v=z!XM%u<5(oCe{y<8z&rN%Jaz zjR(F4RW-EwhC_0c7WV7U5%MTI(yKdf`uoH7)~h7F=V5*tvsZEtGy;)xfj<*$JSFQk zKWs~$xF3@E!0*mFKGz4Ci|?LVI#H3&^R|WhA4I-Jif(Ir+ksnceU7{O*H;M0Wf$(R zLZ0{KgC63ok8l0Vw<+FF&xGpe^uS=d!zuNjDZMi_SkVeiIp%C)J|&|V3@M$xcZIe9Q<7cHY7sr#cQxoD>6nE}3#e^p* zyBIZp?+Tc&t!Y6ogM64&zvxVLrqnhrq9NoCW$93eADLb*t5*fEZ{GMYM024q`sCwt z30#*HrfP|1Yf0*jjAIQhq2M4Q?ONroAv=dQ!{iwHsvyE}MZ(5a!~n5IG~b&OR}DEi za__~RP-Hbtc}}=a>jxN?Hp7_niH9J*3sSK2_+zu-qEi_o+?hEWSv{N(UMhpnP|}~B z0+DM}TT$ee#>@75X*p0j0V6Z5Y>fk@l~$!fJnKTH$79Hq@B|P>G9_N42xm@FIIPzA z1^6^cfLi4#NZUO^@j#pKRq{Q*$Y#h0uENVp7PuhMW&C9DUHaaeH1O_bJ@T+yj}CD| zTqy<@zYHdueB+~M6AMvr+Dsn(jBJ|k_~zrAV0 zf*ket?>hs^b>zk;tR<7vz!TVQ)}iW_Zr@omG~NpTb>a3+fV8$&*MrE%EiFife!2YP z#__(n>-$iQ@7!-(#t)|=sVh&dj$c~;Wp=>H{5z(uW|#cwVV_)< zU-nnk(K@UQ>Qxpz_>h%xtEnvphBXIKsv=E^$N_p6R#hAf-AJtcXMzjZ{D1(`>Kp2O z8JgXPSn>9If|%7n)Ksj1&QRw{oZ`S{E(&O_fU6wc2NI9c6EHzf*sLu$xx0SD=l<}p zse?F{Y-vj!p(A;)8Ax@^nG}wY8KmepRZkNoHyp0a4$R@;#!<~6Tr|ML$A@Xhkx1t^ zRA=^|-_ER3=PHHI&_ld3cxHsM5o_s9-^WAAz#%HJ&&mqYFuGD5_8VKrl-V{nR0v#X z2w<#g)p0K^6F=JOz0!ByM1>lT0!KBYa_i(oBa*+2O8@8C>i-|;X~eroZqQ^xeGoU= z7-I^s-f=`vAE%!E2p~Fwp1*I$+MDa@$LE>fS9-Dni<^e_l=LYfiYj4h2zr_?V1rlh zn&}7(+uq=zJ=vJ!Ee96|4~9k)5e8NfS^W$dF36XRZ08-5-O8`i(&Y68Zb)zL6yK!0 z58h^XPqMxflNb9NB}6wn`TUol?i7LA`UTOMnV@hA#+@czg52sx9R!XPq=o!+IvA8Z zdfNw@PB&LapG}QMpX;`9ZrSR zjF%mWRinL6mc4wf0|{U$DGAKi*KaLrv6!S0QwlwmZGZa^>P>KFbuHGUjE6D`L_9lt zk?_Q#NKyBk&(?FzI_!3r--Q8&REo%lpWNF!#@AVMqJ%^$)Rb8Y11I}!3Cf?zKuI>sjU1|#W3E&dMXrJ| zRlAsVD~og`)K4M`G#ydH@P5EbGd_j#Bq$WpMneBe%{AX%CUAgK7`14@j?R+;+y@{1 zTAKUSnRnT>&D&3{-N2L&Mmv#IO?!|~z|Ub{iTm;e@DoX(1D%sf0x0}w`hWKk!-4(h zbItt-2Se(AVPrxdlLP{g+Hj094fs)=IaB$2rHj4Ky1OOE-w!p56J9bppR4z42J7fL zo_Tu5{xV1)YAfipdi0HvQsM}*{5Bx9FwZknx2k;;sh8@rY)0|$amfw)Re?d5xMu^5 z*xeiU_2Q0FLH=T|X~>ci?3VJUeEq6&X=cQl+a9S-wCpvFvm(!AW*nq=@UDZOIZOiq zB+hscd|bqSeCyfl-gcq!hF>^HC=SS%t`5S@=S*XNBrFPt7)N+G$qit3U&(N?C?lpj z1k|CXBOchlm>!-D)XMxsDIs~TjA3D}zEc zx~>J9-~5##qBLcna9+9W>5BFJpHr2M#(#G`O@F8Ancv&K;IZIy z{2DQoVS|y`RAEj?kkM;esNmH2(g&p{GRhZpmkT$Il3zQa9gphPiRA;q^J zf6zLN`B59l&oCj7xhvj4PEOjp6iCiGZO1n!nbEiX(6=q+*HWlf4(U|=2&@LC%_po| zt>u6dB#z$K{;n_VC_3WGIGnD3vB_YhzpgA8MOG%rpcc3EM+b;R6Wm2w8>i2>-TTchrUM5cd(G{XPwwIV;Q6K zy3;tB%EM4mLwJ-`=f$>c=q8SeOKW-u;_;1p`e=)&c3&6G-SO36(a`1h6d}%0lQ4bi zNU;Zz=J7kO=(nQ!<*^lHeHX8ZD%3VVekLPr2?=t_INbQrSsS$=mI)?CofCfpct;FR zOFw&^1vXLUDy1;eD;T=J9}>p;;hplF2=R&=jVF*-P0~j92ytvy7x8um;LBGdHr0Nl zVB&wHK%WpjL;Avp93xKV2my~u>{JXi1N;hw2;y)~Ft()ncfg7{V<1r{r%nSumi^X; z&X91`%fKqYXvcuJOnr*fcXrr1lYgd=X3e&{cq_szOoRJ{EHJC z*w&A!$`e5e!(KPms306d9D%;6#{i4}o>e;ZL++*tKV}2_CB3Y@Rs$iC=cMyg^4rSh z4c`9G&u_!uGS~+=yhw&TnVJWpk)=|y({NXA`w<@g8jAg(;LWf{kr`m>>|OuPa0RSK zLl4W{tm&@Q#iTFMswgl)_uT9YE5^h$|M;1#{eoFy`HXKj8r}@7?(0CL#~(s;$Pw4* zQ3Lu3led~UXNUlfk-5X?F|(aFX-*-EmiG2{N65DPrnPi}#9Xy!xBqCsmGvnQy`uJt zSHX#AxXNt~V{E-j?b7VC?%$RC_9eRNJwr;e>TkMyU$6^UR};*XM0g0q@)y^yk=B}C z|CNvZ44xn=e#UpohTVbqD~GF&_j3C4;3X0lwU+Kd{O1$%^($o695r0OEfF*_5Ekrh z#vpFL@enFrJsJ`aJ5An93Ojo_pEFkP9s-C!bfxQ~|(dgkvpnZn_b;`O(W6sx7>AJ5vfTN>iE-prh zUB7@-138X3A-kTV5ZoGw0E@W_6yh3K$V`Cw(FjaTJ9N(lvGZSYL0vS4`MZYfp9yXc ziPTU9+PLD)bnsLANXFD>^pTt*lMZUPmlodV{_6Wa`(2*s8otB?`bV9)?&zFSMMdD8 z8HjE4BZ}$YRO!G(#X^qxW9nx5=5Xw9V0qvX!Yf&%T!-I7?Tp*y1?fp|N180VeuY%Z zkFy_5&^4af;m2Ea#3&H%D`WU4K9vjj{{UrCZFmbz1tG(=dlhubaJ>J+6Nv@KR9Mx8 zYM94WeO?56-lv*--NSEZ(qX8 zA%{(b{h)S;4(H$2%Mhh*_0FK%FWnR&bv)0sbkem0vQ0*}Ufw*(TmU`O1HrFNz3JQ> z%^ccfhut_nyDK(gdj$kCQcTA>*BKCS6V4RL>xWSJr$f@3NDiZwT<%3Ca9$ZY7(I$Q zkYx+h05Q>ZIZ`zaA0B-ECExI;{GXkV;LJ$>`S`YxZL>X9KEd7#;pjrm7O&E$O?6t~}NfFJzF2|WtVTn6?l ztQmM+K`RWYe{I6Hddj0_o%!cR_oGR5KK-Xd6-!j#q7x|Z86YYLP)_q|SiKVBVNOD> z*=4f*jo-b`K1!e_%D4KD^aoq{SW%8keP#l?=6R!eyT^tjF;C=fG2hGx=8D_6~AD1TvF}t&L(M+Y7BdH-RV5;j&#-`eVop30MxBI2&k^Mfhml9ax-~Sca>S*^HJ{D-yq|lD} zN-dS!(D50~NZQa+s)9HXlx%)iuEDQ&iu;UxwpEiBTu)Hkavu83%1X^XM`ntieTLA| zdQ+{e&R|Z)UIv_t&XPdgBmDXhY#(<^>~E9+O*tMYNrArLr+oJ`J~*Ag2`iZ#)v5rR z-$7Q7UC{)7uxi{*s4w%-*FoHkCse!I2fRqeboFPk`QhTDK&Z?(`bn#H4)pIwM%BrX ztQeP6h#o=*aMGg+lC^l_P_o`KrV(!odCrXe|2;McskYBZ7?*)p3t!4zt&3@iBu&Fz z%@;D9w`ddUK|ga3{+dk@=UIk1irTK~Sn2B4Rz&2)fYD|83f2I;LDxMO#(evgl-mO= zcR91Z&M_XPvTyOVOf|eL3@8S5nom}n;^-uP>ko$pAc83wgNNVCpRSA9FDmLFGJix2 zMtb&xWC`D@l_~t29+WK%`n7C|>v^-&tx-Z@jDBqrOk_8ixi%3m6}>?Af&`RGa4S$@ zEQR@Kxz1sZj!id^L1#b5dDg}f{>#$I{cha7@Ax<4{D8>j~<3q9``_on5Cu+oxLMmy@MiwBWmir~j1a8UP5RG;gzoDvsg6h)@zG=zKQjX#&PMP}O0|Mx*YEE#dRX%ZXawi;=BN5!q*I*9 z!qGXrs8$np^!>))EK%XaTeg_P8A2Tx9?XF^n)Z$N;my@I+9QWYj zRu)-`%B%__J~b{Ki!&~t9hByS?^#O>O7Hc)gvmR_fr{;K;&9$;|4AhsuUyveN37h5 zA8zty;v6it$mDwbOohnXRHZ`7G(PzF{-Un#FvFh5f)>xA=uUQ z@HP7_7QWkZCIl3?z8jR9zU9Io4zI^xD-80U1(quZ&|wn+QDx`CAn zj`1Ij2pn%;<)B7V)rUlL)$DX8EQzi^m~>*4`!!3SD0CjJIec#~4A8P??Z2)*c(Ut& zg34R);uWK)Qr?7ZH++K{nd5$iP^&PI{;26z>w-->J#sa^_Go7e0ehs{$O?S-`@(t* zA`IudcF$~UoSF#oS-Ei3B&ct2K#;`&v46lYBZEN|^Ko0}g!&T~O{k$tgcZILLV2co-;z;J1}zqz1%iJW6kfvX`( z2c&gih@KIvn=vX*hcX}4W&N7G$v)7y9sBG#h{Ji2m7snsA-ucf-;6VY^JysxMAFhi zPjSPv@#04c1j9znIyD^j|J4)wqo=Qb*@ngsaL)TYVD0G?RwfYa{{t36Z3e<%x{y;g z;Xa@2lO2t=M6rKv`IKV<&)wh&fwa}<3FVJ_A_rW&m5VCc*eT!EQ^0hF4xC?pe3Oi6 z`>9ra&0SgOu<rvgxbW1{%ky3 zND??LvGi&Gd9ubh;R_#ZW@1>Bc&G?~%Fak2ff&}fsR)!VR)IVfOU#XdHoP2V-FIgZ z7evR12}e?6GXTAg&Czu4`@m$^g7uuq&j65>!^CqV4151cbvILKodkX&D!r5+=V=~4 zE;ZlE0s6_BWWoA2r%<_wEhgX%h5Mip{)IOdDxaa$`?}~@)w6>sF}m*0{Mp%HT^R`r z)q?Ay)8~3@F{xB=CRI2FZ}_V95==?d9LqVgzd$8nd@UCh(H1an#c z`Aqw)IVF7~>=(%E%!;q(CPhmlRHCxVC-rP5(jKuHe23t$i^bvFCD>1&rRzFc)Is$% zj4a(Kg^nqtFjM%``MmdMP*c>P*&X(WI6c)FvVry*s`4dWtV?J_kO7+d=nl%%HX*zX zEka-&eAZ+C0=~FSUR!lC><`5d;yVAEi6%-M&}3`HD<=K2W&=97t_5fCJU0iHIOfuM zkVS4BVw7&#D;{Hj>Z;AS@2m~aJBDe(v`zp=R8b%*m=g&W~=*Pbl5|nN-a-oy;?mxzK>i z5Nw@yWh>I$m4G!-2c0Eei+({4X99T%MRxYS5uR@K>NiTd&#Nnt+9_l)9F||@*JJSJ zUbZ;;ipX5o54XP=n%u7c&|+Nv%`n@2y|7@k70$w%b)ueVVZ>w}0T-O<=vGi4 zP8zTXY}0^EPd<*&$;KrO`+=pyydR_RvG?h?(T%Ls4c9x4wNr(9$c4+(ILkWB(dx8v zUy8N>6;S0jaoC*JcH2)IrG zVR&zLJL$W>M_vhrzE~fOx$df{M<5eL_SH9u?;ddaYjfJt*`3N_q6}pu!j`i>F}-^; z&N;rgMbRL4X5+2T-{Zrnyl715wmqYc&yKo}4dnQBM60sqRU-vbsr0^fFnRa#9sO|6 z+?gGgTg~<5_TejWg1SS4e;uE+<0;)HN@F+KprTAl7v^wMa_z<^kcFf*d31u1lmv-j zT!d6-6x~0iTj^;|`4^$i4s$Tuo(JXXO(TjBQko1KHy3c{*!KP4n8<2J@ zqPkRHHq4V6fLuqBAXVsBVXxYx@Rxv+?oX?-j7d#!vOM&1pM~o*mA0qUYSLbFd(U#g zE#r$Ou7cOS`;F^08{9dw0V8Pytprs=*eDS62_mq!-z+V@^6D^~f7=3P^#cv`P4EWKg}yP#kW^ww~mkDr0G zE-I8uIbT)}Fj`@u%K7nE2J^ECj#nr- zK3KpkX7Rqg_$Sy7Sd~r_JZ~zkI*B(Def!a1hY`xwE~4lVC3Q6 zg))rq7pJnK-ec|?FL&-Md5dkUWX-7fLOj?40Z9FILN2P*gXfQWp;rk7_pOPI)(4;r zjhF>j4j>fkHG`Dx*bTb1B!oNZRtg4s9zuhVvO=$gG!n&mTbk=he|-AifvQ~+e)6wL z*C~tq&i&1p#8k3V42H1j+vj&0$dXh115!HPOU9XSDU2Fv=v{+ba%x7T5F^3pqVR+N z%ruS`*E&0$Df~ZTakuI@d;Qlim=&vgO}=e-Y|XdCi=c+|=X(4=9+yiSVA(Dxxpn*4ktzeLCaGxf!lX$8U$ zXQot)mKc!Z+Ng8-z*HGxJhsZoib%2k7346F)s+C_rw+?@X;|x4KcTUsDEr%4Q0fHb zTBLA-k%p-A&4Uz-!yDl@#6v!H01l@LEFswiNB^^q)%)+n z6B5aZ$BL%^Bo@$agX;QdaKd=}aWAj+KsFMu8rrk@$JC>)=2&wz(;+70QjG`^L+=(B z4=Sd#v*N$7rb^4LBKf;g{ajj~P4Y<-9k2Nh@KdYUp}Bg{h;#yYB$3RwbFTGqSnS)? zHEp;M?JzgWz4y-;@39G4$qQwl?Br&u>Eoo7_kpo>DK4+Rwfuwag)bXdYr#`l4;;34 zLZsq5rAE`f-R}S1a2PXjW}={L_|#o*{!=NSKHEM=N0`civgBKBxdxHUqvva$-DK*? zp-)WAT~zPoIg81lX$fGos^nc7xa(1kyguJsB3U47rGtuDjDa?qu0#b9hwzma)s&%}p-I2h3jO&Rogc}P2hkpa%8Y^Qkxz?bM-adG zeit6F?z*LN?*wrlADkn|?VBI`Q7KQA5Tf~u=tn!)gsHpMe`7j?$e)!>LGPoHDhMCL ziR5l|#3#|Fs1RCa-iAbOC#9`RZw&uuG>pvu=7-OgE>Exe7_6)5u=VD89E&z!MWNft z*;^*NKUD!m_OZ)Mkx0hn8^vZ(koInZ2!-3jV$YmeRX|$qMx*zC%7*)q%gOtUZgE1- zQHwdhgWpbGX#DT`n==sSvg+cq#@-^f(f5b^{P$s1E%=Hz0-XbVrkSYL8eoAh$YdlD0FvozQ*Nr z{F612x+Nepvd$Agk6fU$;P%FCs~(1RG&VHcwV(x`+}#suSKi6Qw4zQm4R zrZZVw!@$E|RMWzn?3H9+dp)-H=qb2%ToCo19Uw!pdNcv*3y>h+k8rFj=hEnG(QHv1 z2jtadfPgC-BWBv9Pt6HrSsOpR{?Z&b`*pPK$HWeBo8-2M$(O4jrd+4qxw@mB9K`TZ zj_<>&(O$d2xaLS~PF1y#80^`Zh3VzMSvn9sqGQFx_tEw?jD?|bn>Ja|g*VsHDWqoY z=BXL*_c_0p8VC~XcN5dv+FWVDgQ^zGYsx>KYf6qR`P-xY^W#Fnk0yewr^)s0mLIFk zbL`Pce?O!w#6*;(aA%Wa5Q?gQRjIKb*Tl(u2){#k*esHuK4 zR~HW&j-5lv_(5dEZe%NopFW=U)$F$HG>@NSH9X+L{WA1(o$05#b2{--9n_^Bha#oh zs|Hg0fVy*&&pezmWo_}+d*SS8VEC^Q*;zZzg&)ytBf`d&6L}abT5Vy}M9)J8IYnO} zwGl}?PH#CMM^0#l@UGT%KcN7p$x^C1RY+eqT|W@36-s+(R-OoU>oro*BtvT6T-TBg zRjNl#M#(OIKDdmy{NSpQng(8CWZb0jl`(%8$Bn1i{O@gYDAx2nuT=kYmkT=e)`1P> z)Zke;OdY`OS7z>`RSqeu;**|4?AGE`gMi;{PYdVv>!N2 zky*$8}tRYLlO^R(^nQ*1AczNaEr>kiWPNy37d9i)|UrB>FJm4Wct$zzs!;lX<=@0l@)w6ec?Zbjlz8n1q z)h<>FH--PsgSLP7^|JHNTB+fph5lVN8vEOST;n~3a_r&Nm|nd7$aTTF10f?hwR87P zWYV9~ZxAY4(#qtE;Z9QyztU*6aiqa4AnZha{ga)d!G3zq|6={H&DNUU`M4x5Q{k*O z!ZDzo#!tvS)xZ5h>aB90X#(tyly5}C7^PqJ}HIJdyoF+&C^LQe4*tel03f&xN zjJ$o$HP}tx)h*gyjRzgeNLbBvEQU5sqC)pWrw2m;la80soXjQH>(yx(n+WLieFzsE zQueVA;UQJV>(iW=^FF1jM)L#o_?H9dpecA)nV=qZ>(?ICQJ*OsMp?(f-3e|8Fjaru z@wc8!x_eR;%m3^m_<$ZTWSmp36u#*fo+ha>g1Oy?#njz_4724qe-}w{p<8`0N-3C6 zr7vy_>=d*U?9KrBs^R&`{iNhNn)a>t=v$K)B*>@l3>&$nC#8R$N>~)>#Q=lF32^F0 z?U6J&dvt$)=!-;EWQZ$s1~e{}kj@?y#M6^SbLB{SfEOR>{hMU8mLw(h6bIHs*X;;F z=vspbAKk0{Yo@@Vv!UQB{AV|p4&`jmQmHf?ZgLP-Ro(|R4zw)?nmDI+mbJ#ujoSVc z8gbLVM7&>PaOMecH80C-BY+fMNdDe^CVxTmRAIIcq58Hz@qD8RV^lATA2k>7;V~5Z zucieT#R=of> z335JTSe_@ojL`nzyY#E|trtgiDklCO$gizPgVb?1sUuv3QZVyV>WG&7aiy-b?wWrb zo;m2$sxf-TFdEGHR1!t82D3Ssx`)R;~R%X|P zez<#V>YFNH+e?-&go`RBHL;K+l7Myp!!LaR+l*iuckC92VTXsl_+;TFkM~AJkc-cV zNZouG82GKOa&0htAiH%{P{%ogfmJ}qYl2@Dlh0)3rO$c7X6`BPKOEwT01$2G$1?#F z7GgTG;-@oTN2Esy_0V3wZ5QljpZnWcr|vup>Saaa$}PZtXD>KUc4ZJ>{Wk<@3s;7? zy6z?@M`*+q^hPTGjOL#`kDp1_WO#M8=qkSxSPHd0lc3vb=k`Y*FyCO^6w~IgM0pHc z4=lEt1GcENG!Oa<f*gX#e6r+@`%gLD$mv4sGL@dWD)xcm0}A4kxLXrXu-xLzJ+RAysRJ2T z9aeB?BSUA&71Z|gF_!YvV@}j;o+1(_cs!O$Mlr^(7r&lOME~AHNkhVt zO8A>;bJ(DPz{Ily(pm1yb0}s02O0lV-zc{KokD9$lN;;kEE3LGcM4)@G@yyT1XFiF zsmg(sX%nMnF9+HJv7p!tujx*}rRE$<=>FALyCC6sN})-NQqza*FCQ&xJmjh&YIc#} z5#GbuzY0Kxgx&MN!4gV_CAXTM!D_(3W61U82`6DVx?&5&7{;Wf6X-er>4`v0%`zao z&+SsrO~}c0Qya~}iL4l6(rbos}60%8giX=t{gK?+o# z@Za3)l7wNwK6MjIPRFNwlAzmYYa%7u3d@j)Z`s?!mU$rgGy1BJa`X-m>>=<(6yPnW zC@?y~EqWiZ(iZNe^DnBcTh#N=u_ zb7+%L{HJi_-JqHnL$HJtVa9`D73L3T-3xM4Q)4xG?BNjKdOXGg5qG(6k%2W2uNB3^ zsAlCfB!}^ZL~5!F7ur{V7uOmt!!G@)dZJ_nbYsOl;aK0_tCLN$u5Q3$&(V8ZjYwj! zU-N6qQg%NHgkY2X9Z}Y06#|D0dMhnxXUBm>)JjT29Bv!whxJ8Ht#8r{Y^Jn{5SGP5 z?s9Li-6i^6kWQTn&~E+`f^j{YWd&mB(tzjz(y4H`3{)5=-Y;GLY0Kah8ON_9KlF{KVudjv*j0_U{n?9wPm04?rEnrR(G1mMo!D}BJm4{D_WyQ{*c2`=Y|ZIb(EGZAK_M(M zO1^atd2a(p-gRs3Wk0m%PdQSl*t8#;(Yj5*NG%B~`Enl$k6kKCKCN=ROw<(-q`5)uQS`Tm=ii+22PmYjr=Vd zw2jiu)~9IfdUG+&P0l`n9D(mz;R?mKM4ppglXDaNajP&onzq6N%Wrhv~VZ_+(aZaJg@b2vCwZb5Zat3`8gEuDI zrWECG>TAXVA^TrvpY(zdnqQmylI6`{kKh#`#wYYz@VacJx)OV>4V;OhaN4jElp1_N z-iG<~j0}CG%wFdI^(QG+KAW>NMkto;N4+z`$0)FG{qWt7nN&8-16L-@ zlOv+~34NVt;(CW~oQJ#$UXXgr}}F$ zbG{`&-aDXMT;nnb$T_>hRbD03ez3*uUcybrh!CkDHtO@ezgC`U(+bGHwrnL`#S|pA z$e48)!FsAvSn$8hsPZf5&3{$*Eb*Qbp@u`o_@k5%T{5&ld;Kp>9H4#<4t-#iDwm}a zNyTST3K@JMX3VA1Ml{C%9~|SR;T;LHwG$a(c1VhEDX6fhA|;&D1LD z4>1zN@g|Y#17oRkkw)c75m<*fkh6ihIW>!i)9t)`w;?;dH_rP6q>tPf_m!#?d+saf z+k3(WSHY5sT%*>TOs8rIdG8#sr=91weLfOye}_*v%RSkf3OT0o)lB(^U1|ImOH#9Z z?v5dKh=LpP8!{y429oi+K*(|P(tSv+GP}8r=yN+9jl)SuVDd>KY3wiyq^Y;bcH#oK zgmn~}{VR+Y#v*v4U46R=A83U$zr(HH@qEd9ci7*RpT;Or?ZkaR{i2Aqs_V^(-gFhB zIl_ngbIDYrmDS!@L)}m7tb#6$4*}p`$Kd1huwVH1(x^qswLI3F+(miABdTXqnz6Jd zRqTo#=RZU{@ig4yOmGJv|2g^1ls=w0LBf`C7zywy_~SmMScJ>Otc$%KoEeUGy|z&n zm-y%O-Xx*PZR2d*v;C7!_T@!!O#lBl$e3pXTr!dajLEdo9%)BT-{jFnxc&M&^s2%e z1Zc>CW@t8~6owDO0Jk><91zmXEpTehByj31L(Q5}Msp0G`;Zi>@YU%eYV>$b?mla_BOK z!H?x^3B>2O8+XV~f8USMGE{djx%B3FL8(1~CJ5^mr*fOPz3xndK+kWBZ5%_c7;RE%ZfWmP-B z*t4N$D15`l&?{%C>^_$F-}-L^S9b9E^-^hK{f7B1p;Z=$K~Pez1P@1B=P@PdYJHgF?_lbKI{R*hfFiDykLu zX9dj1c$)m0}jcj~4;+gcmMZT!#%2PV+hLFUs2M^#+G1 zd5lo!U#{8`$pnc|Am35)p53X${)>*jKcWLcw_+&{j`P7&S)gzYEj_GL6#i&law_-( z>0NDlppI6%#DVg7FPq5}U4N}hAm^p1WM1Z6aJp8h1-@$SZ9sPd>j42-{mQxGr}sG| zDf<-lUs=b6r-ug~fEMNRcsd}oE`VG%TAD%JfMJkSI~nMIE9I~o!>3NOD4s_teUgkc zYs!RiOu7BbJn-s4?h>p(D!5pBv&7_aE2vv>az;|9!FyGG;`%3lpI54YUL$ z)q8)CG?zzMMsEm6!Y?l;wk00ysg0A&L zNI8t(6Op`Cb2z+P@*_3}2k?5bh86g>arCzLEQ=-;UIWi24D}e~i&}3rN~;a-OW#Uq0PfLc^UE zaO7rK%IHfg5bjZ``*pM|ROse_u#{8!+gz2J=%;=X@cPWd3 z0(Y4sy38I^!##UVvhRrYI#8D=rt;$iaGvlx9?bg$YZ2hZy5L<>fyxy$DYj$z(@B_u8W!|RZvPhLRO3Hp`8`xV4h zxRePh{9Ro}a7!PpNUvkE?UVmZiFuW0?bMI=?0CKmIg_!x!^HY0eZGq>puvSo{x(52 z#+k@OgSVa%2mJEJmeCbc5Rt^ewBURfa-5=;h;ddw-I9uw&xo>Xgc!VbTveEDEGuSlOxgpT$9XR zDO2gyYg&@Q!(E6!xhS#L8OmI+t%!M)X(!-zFR&Y&1B_O~YgNi}rsj>BTe>GzI=EWy zlzw0SCi;4Gk#W_Jb^if+3mRBFPhx9o|a@i^%Z?XM@->TYqHZz&(D%vR%? zY)K<^USO+_Z9qj=S8)i;mY;jV^4U3#IHdsj7(Hd~RR8&pP@vTC^sV)tT$xFCIr&uH zhm7n4W^qW0mo?&pl!nMUP}}*qkpQbGWxQk}K_mQGK^We=g;CcUhDp9m=F4LnOhpPN z+0uHMhWU$0&ZoP={w$LXofU}drQO+&^<;b=3xa2_6PaZ2C#oM36Q)j23)_&@DW(nJ+6eejKmSR}}A&Fwrt{o}VE7C(En_vH+pQY^2m!hkYf1+FC<9$gWQ@u|z!9!lQpVjC# z|A}JIR!b2FDmhn$*jcDIHD@8TnmFC7dv~TTs^Daecw(p~Xa0Jwy42NH7Y^an;74+@ zLTl>JNRpFkgg`3qhs-pp&Z$htCW2P@-usZcc?*1L!vmnJrl^jiI(dB;lH~aB0a{{q z{7uvNQcv!`j(>s)%ONdzp3xN|%b^1Z@LkB5GnwKL#9Sq=Q1ZZ1{C3*D=hy8_$HkX(rv|BwB(hpW-gbCo_!f?oAN~ zfesco1eQQsG`@Wp_Jg89*3L!By}^i8G*;}ym~9q%3kx&JHEx{?(4s1{NK3CCp;vS zS@ilvI`h&l_*(pN1EmbMwX`S=yeZASyeXVdzoE$OYD4_%~dL z3{KwqV5Qpq#o<1diC-}jx@mI;0RB#W>cp!Nu31H+ocra;;Id9EpNlWUA*lYqYT-gQ z^;i?Pg0^;kMzZP()3W`t4qz|YbZBY7O!`+?Y>ne2CYP9s(BN_WrwpGNiM9iY_C2eX z%HyXAwA5?@@w~=_E!dMrPC(*#kKJR*+xvk=fSkYIq0AI8GowC5p&x!^UywcZ4!tO` z;laiESV>D%xuK=fdl<0Ny8L9|42HeQ5=t-vNuHYf+B^`+K6LOY%$&;vZa5r$G|E#E zWKDTNs~w`Shm~nYt(1`(t8>busrcG5>gBY{40DJKCzkyl z>pecELe=wk0$R|}UZxB*IN6Nm8fuN&tyN{R>YOVY57sI6TMsbVMRJ^5s|K;|(ViVWk2mcenO@YYEi6;w-&dH{Orn9Qw+|52G@4kZ&3p3CWtjSSFZVTx=5lA9 zS|wmO7m%zlQ|h_ZHxj>S>W7YjkA0$WKSb3$j#2kD77Z{vD1{W&=(05KOB)HJ^Bh0& zEwpf>K^ibF(=HKE_8Gwl8MzPz^+3;VR=ywUvTP08069s^LF0L9I|;Qe`vNX{qJ63{1afm(-*m8 zfj^08yqhz}u}WvQ7wL`u4gZ#`?D;*dz|u~N$Eo)M)QDX?$WNeteM1j%K+5(Q3M>3}Z_uNHov*7|Q-gS6}QoB(J(5uj@t`e{1&0^LY1;d{C zB*0bH1KxrdC1?v(xfJ6mmYSU{9BjU zp+>UBzlSpZV5}ek7?_-O{39{1fWm3d(zhUs7MV#21XiXMt)7 zI|*o{-+hgh4c?qh5f|0aHo=ae&#Gb-HC|XArere>%xfvf>JUooaJ{X*7^|Y9(A@bK zuJC57ei@jW<^msO*Drrg`dUw3H}$U>fr_n4M+4`Fn$#jb-Oo`uMSW#6Z79LHCrH1n zz91%>C65n?`YGcyTrVYHRatgEj~y5cvhy68gLE%KWOOkdSnEMNZgk(@G`xAxyo$L| z^S4E)99}EK&dbb$h3Ze=&zr<_8a&9BoBF1>(<2+DT++8jf@hf$J{4VwT?=t&QVJm5DgDFAqwVRDE&>@PQS(&&zY zj;zIl@-~F>$NYQH0{qk-&R&W6D-czCSVHPpOo}7Grg_^;4XvU9U0c^2!%444N9=<2 zhKDl%Wr7^1;vxNN9p_$7(-U51EbqQ(D=umHU|0s;>tq)ux3lhWlS1!Z6bt45>?x+d z@v8Lh^Fw_Af>fcp9BF%ZucGuxz7t{H8lv|eK`5RD4m|%L4bRpVeZ&Pw$w=YxWL!_x zy?j0`Ht8O`MqaY+!xpPzjjDy+@rdrXq_fepC+&y}XrO2uJoZt(o0u;Ot6asFGl(ZZ z=eo{L;xhl|ogKvDT!SVleA>k-FD9rf=NluSvpZ|Bhy{B)3z zJk*<=MsT&E*p+R%586Td{QnC7eO0zBOO7-Ux)Rb@qJGK!4l@vDHFJ;91-bTs8|Qae zRqRM;BQikj(%f_!Ja07-laj0zLc^>{hCibtJp%-^CV`t8EC($1bNHG+>o+983rT6q z9x7~e*KFj?E4Nerfz`%BfCU*NboyLEMIPQm??x2~Bk%N!_vgiJ{T_D< zJRh&ix2elfGBB&@%H_!(8{LaB{k|`D`WKC;zDoBX0GJ?KW@clG5CCJZe^%xuHBoX$ z?4TpgvxyWr%?SAyQNG>;_+c&nGf@X_v0IX{396!F#0Fb>*1IBHx>Oj{TJV?fSscr9 zHp3N6YT7gjF`?H{1+OdM$o$@xaimzyWY&E@E6U2uP^dE8nI5DTKV*)HHrWXt3k{mr zY0M3`oQ+RVDrdRP`EbsG>b95Ok>UP8oW2dO?~6~cDC!Uy-4Dv*cd|b!;5aw)ccp3~ z8Qhc}2d(Y;zOvR+zkqtYRlw;Y?&vdNDQjJ1v4=nQF7i($*%`1oO_YeEK-O6>*8=v- z2@qg-I$C=rp3!!QsL(*_LyG+Rn(L$5m z*<|LF9AcSIt*bZadbTv5rKcT&lemPJDfHijXwOxMj6**-G~kacUbpRtZ;|)tgS>T{ zgeoRUO%Xwu+E1YmqeC`=W8-+QL8MYrnU|lKgVe*uw3)*@TOeAM*%k9x;cwQO2asMj z%b7yh>6zI~@>+j;w*Mlzxsy1r#^Qq#ngzTSC&|iJM4l86D4c&qNl^)JDD)VTM2PtKH)Q`Pe+|GR0q>917 zzwp}8YUrC)ecEHa1AB$q zY?Xg~b&8gU!wtjW@vb|$FzhHRYFHIvl1+fcK#;-yVUc4}d$~}wn7zb>n6fbDeaCWg zxj`8xMBBhl6%k==TQB-X9qm_L)*76Or2~W12?9n85~r!nOR`$Lts)L0DsF<%IGlcT zUb*dv1VyHPc~U`NZK+M1e;%jj=z#aW6=_AXoGw1zaS^g$%=mZIMT6()pyF&F@)Y|f zQ7YFc(_oRUp$n@n@1Nu00DJpxJCfpx9r!CnJMnodZQXV_cfzr;LQzW=_7SJ?Q^>{D zs-}rwSii+pq^C-h5mgfWPc*7e!{A8(keBvL@9;Mk`L^>_2uGLWaP>B;p9P-}cwCig zj9+vj$iqd%&GK_m;$7=vhOTdezKXa2U?8_QNUKHYjYo5O2(33alPL-)fKTOTK%%ah zAAzNec}!g6f{88fCvF{5{ob%Cr= z61h@kN8+~_%&(~8H?ICwVN@%=DKXfw9gcUAl&6vVMQx>5uY8Xl{VroYS!||Vi}bGZ zimq)!0jnfYZ_tivf44FzdVmlka?3n;07+fg$72+QWtUU?>Z0}mdD^rU_ z7zbh>xF$~zlP}R|V0Um@j-ju({qa#7X7{>ceJaQ~RZjuD9oV6oR9;hMX^^CBK;j-6 z4|?6)PCdsjhHgI;-`};P04{^^>l5|fk_g?@SfV$$t$5sli8Uq!)+nhRxLBNRM0bF( z=Wy&qi)Y_U{)4|ppQ38G1^D=WLU275qdgY$iSnH?+k`n-k?WrjRo5|e@0oOU!f?2% z25CrYo%jtU9Ujml(~tcnVGuoPbb@QS$UFEWcB1GF+OX>RS3pJ8H?kxH-u#~ou-O^{ zL2(FvHAY8CX0S?+C%>46SUD7JK2xYgqJf00j2rCLjMG5D3f&6{;- z{A78)4IwJqTSsSmwJUsSsg@5cF~Aoo=sdK-5@z01mF|HKy&e^90t}+_e)5~Y8}2gR zYX6(Yfic0F@N` zlY`8sUxnRsuFG;)LV1lmxeCg12Lz0|0s(mM=-ePnsB|2}^13p{B zJRO=}=dXK^h>l}dF>#wT?bJpa&9yf0{8b|a^z9S>9lUW^BXr2{E#dJOm#wJ2sEgB2zp=x zJns!a0OwbW;aEZrwN}yb9Ar{5+J_DM(m)~yHOf{gzl%_UcQ>i4JaC2vGu z5gp)%S5I7O3TvdL!CYAJ86$Y?m>XHkqBnUAx5_7)&&* z_Wm*4bB#5SP6BLC1bU579346cX!!fPPk;XgWWih00`s;tHg>ZJXB>?PB^6Q*+XLUbr^BRJwQf=R% zmjD}$@n3bSl1&3N@H2p9$DWsC5P3enrGaM4WvWsdw7^eKH6*kOLtuh0FrRg4Mk46= zt$foPD};?E=v#&0;EwF{eOJWxYFsQiep#@rfl;b$^tYFfKJfKhKR&F1O<3tFp(_gO zMov}e;l2fsn|a62H+K!D25EY|N_pKkb4>BUJg5sb!gMx%tCGm5u?=+yJkW^wTV*#g5ghA|R=Ho9g&78w056zu{#cU%wSat5*hbe6-ZLAq$YC)b7`AsI=ilsnG zYjni!U^ejOTcMBbFF7*9-_Y7j(Mg~jbX8^OIu{>58%Kb@Hyt|{NVk=j>CHFqjC1-Z zw>cx_ne(wdc7oL2-rlFrEHNI`*rkg|jL((7ofeAy{kh(H(L1rU%eclUq^-S8ZlWQb z^F~qBJ>xKU>T1?<`FHZQtC4leSn!(&-ijk^J53<}KBRcP<&YfkJ%*(!%0OI59r_jv zrtgw#FJqnoB#H+b2tPGRw{|Gbm3Y4&mWSBBAFyKCzTWy>qr>S{?C?}j;Q1R#647#p zzPUi6iFo8ArhAl-0BS>ht1`Y)ReqpP;Wcb%!+}6#;?k^&2S*ebeoL<|GPZ5n$-T8o zaVPC5pOHbS$|U>kLx?*D72)jzzq3jzU>Tu8RqJfDdtm036@BB!cL%R#3c>XJ^96+r zall1+T((2eoOn=7N%pTf4J&0s(I4Zx^Z7i1J+%z1CMYe zgidd;8 z$;`&Z(5+tJ(XFWW>@9)g7F*~ThJPV-MjhD131qAbg8*2AUtI4K-7f4zp)(ZqlskIO zHxv6mZ#8%}#i-=R@nu}`Tq=oLKlvi$0J@xUfj0;mJOftQ`Aubfj(MdVakHj^slfH_ z>Uf}Jtq-d6@nObz3#Kj`O6qX2JDg0>c+gS~fwumf?*`IXX+s)B2+irW8)CVqRN!tGHCl{Y zk}^J#-APd_OIDQFcMDa5dT1MQEslFCcdwvVLyoC4;8;>%Ov}t((4CazNU$=#6rLiu zq42*saL%+OqFp}YkJu*E?a=WP;*COtHlH+%NOCUV4E4)Rq-+ZVW)l{55pRY!AjM>^ zw1|YA>jAPxYU>oo_VCQ|mUr8kC3-j&_9TwvQTOntEXO!+alIER&46K{elN^088bwr zb2Go3n9WsQyDE6%Lo%?dga<@qo7u(*8V==!y;{5oU;L4T#4T7d9?80`t@t;nU(O>@ z=TRjG;l>@l+nN*);>O(VrurqWx0GH20$VlwMQp3z1HHO&7aEB3=@Aa5V_4QIZs8dT zZTfsLJsFhi3`;9Z7bjaLs&PNWz6F9hkB@-`2&YH&N{xNxx=(`X)Ck;|Y}nzc9lN%p zEEqzVg=EvK=HaOsP~n=pFTu< zb`kT~+JK+=+qylam#xlI74XI0ec8KolIkF(h2#`y5?>>xUdE&DqHv2CnHVx^fR^W0 zE&Djj?0lH$Vo~C=GBYv2Qvtb4Ii;NAG1E~3?R<_Tx6O!0+x4$rkhLtGedG@UP?vPsZO3=A2}y-FTz-|OWS>_gkOkF@LTtfz@r{!mruJH3a%9Q_Or$U$ zwk|0xDOtDIfyP}=?SHK3yfFV#Ik2+FyqDQg|B3csjCzr@6-RZ}Iy)&$b`_oh2c_a4TFm4UzL!@?D0EuzT@pip3y4teDFr;@rg@ zl$6MaVivI1_b` zh4vY4c`p18UJR8R0|p&~0#CLOXB)!}KPB4@KZ^G#2s3=8{ygcx1YWqoaYE>ow7Zx< z__AfpUN`ZIfiIk=_Xw!_ipBwMXFi1gBCd^DEm1K0KJgd!-+I3S9$m6}{a#_3UYffC z0LCXVmrrDvO^a-v$-#~wqK$YN`&e@s-j)JHxoOQ{=l8c*ES>}_HX(EwMx~JbU(5>u zBK)}e%!g(PG>0VQu?<{8w-^1AKVZ^ba9W2LmrTjy33wZ)S{GtcBzF)uY3J3Wu746( z9?~|LF>y!uva>)thtaZuf$`)Gxm+L~)WqmM(d04NP4nTMX<*~LAVW}9|LZ8eY%n=y z##fM)7b|KuCDbEqus_oZiQ{lB`s<=mTMj(}NS^`0aJVFQg`tKrG+1rRdqUVMpM_sY|k7PAOHe zxA-V>dmbJqEB?%JoVA&uL%nPDKTM*F5k^Dw$pkhUJaCzg#+Ofs*?TDUPCi zlAp-7QaLl@bM93_u%Qs-_{NOAo=OE; zWF0342H(xeRG||rO#olq=Me(RHu z-p4c@$ex0zIlo9}fv2wQ@!0>;oLn<+S7CS7k;A-Qpd`swqZ}=KdSL`-5k}v3D%DPn z_}*7lmDXtd$!4$>D$uogNQCp^hS~fh+kWvWrVXG;v{vyw84KzUNn+sf_>WJh-wA2z zQm%Z}#DADl*+Fo4JIPs5&IV=>I#T+iieJ!lOzq&FNuP0~($EX)m_Dl z;t1aTKn1o+hS%239N&IqV)J#PhRsVSes4mX$x++{#*+2|KQ|TflCjGzXc_!)72xJJ zkwxD1Cyoh+8}NnmljT#uZG5j!;w#1u z{;zrLOSbJ1bA+)%I06(oO{M2FGktcuPSacpaw-4xv#B@|fCfK@JutAo{UxsizV;kO zw2*^X*}U0BG#9A+rS?D3z5bL1Y2-xD&m@_m&d-0>F>{Ou^~GCaUVZ$1z^PoANJd!v zRMd7iKEPCbuj_g3mEE?vCF%aZ6CZ*{is`svb{Bte1f&J-72*B*WIqqkHNbGshbAn8 z7vN(^5;#l6K05X0zC2^|5*Kw{`{PP&kGH>;S9&g>g1|H0YwAS%=vNX7tM+cA-HOHE z66u?^lNGC*%|J?FDPiwdu&eE7HP$Pf7?J7}Uw=mFOg<{W&A5XGYtZ;8)mkrv0T0=K z=*~@XHbox$$=M$5s-UbM7mn(Q?L+Qtx2)KHv(77VOUTTl&tr6wK1%eNH(soUgxSOX zfM-zvD9}t#$34nd&8}eHtDNi-a3fS!OZLB7bYECwP>)icXsWNKF_0W>LLL*d>SW=( zY1|Ho!<|u-@&C1Da%D4)dzD^r>?D1A5}UstQO|EZ6Hr)ENPTy;m;-#EbyglukvNcH zAx~f;ywG~%u_{4TKKE4kTYU0hbn9<&Mw~Yu%|ua6v>c|}!Nu}U)I3Id_`C=4EH!#mtyA;9!k%@hI#To9 zeLPLF!265BGAeo@A^x+~r*uZbVzU>Xrz0$xy&-Tj(UA4o)p{hA{m6C6*$xs9y-v$U z1Xxw%rV0Y4g}WhI$hr>*2DVrNzT{1|#?PqK=GQKT4i+{Xu0paGNW!i2&~I8y1=F|5 zHD8iVB?w036mlwABj&+JqkYT#E(VK7f~Es)*riEG5ZL390qSvzI>?PtaJ_h#@2*Pe z73pq##5ZYM!=fZcULog-N7WDaPSMp8oo!AEZ*G-*wZ>2Ot|R9UhcTg9;3wrbD7Ufk z&^#VYJ}YUcS#1ORRidsU`Egy-;Vt_12$8?2CKi{G&&s z5t_b`2-9^GQO7s!Pu=@ZBBX*BE~bCDlAu#+{ei0$8m99vBd1N zbbE}AyWq>D>T8e>(Jb*dgxz0D)q$aj`KQ{CZ?#E~$ z&zbiA3KU=vVS6TqBv|-jx%sEOdXGBeYO48&3^GT)tayDHcJ@@a({E-DmL;~|Gj{&K9V^@GQopwQ6@w?t4T$m97oh-%!wnm zO%+60F*|mm)N~^A4HIKKhw(Il6u=BG#+&7)A<+nDtl%icee|^t??Z0lT=4uvtAvS*# zeeF>|Z&GH2ImopK)!f50*3`T}#N@f#<&PEPArhTr#X-cCsiM~(9?)<3<~g45-{(5j zurk4z9prmCzu51KFGQ%+ky+kBXAxqAmqXyeDo1KfD~^fp`isp8++wTr*ze?e)XlwV zkP%=*ffwf9%i$dU=@*d=kn0Vx2r`+6NF5Kq1yF=%*@y=`FXG%XB!(tAU)PB1`{H%^ z@nZtNt$RUciad@+a;?MU*!{U`_s-bb-|wQF{7UbICWzm8!K1Mxsj}Zxb9!|GK6jrP;`I>>LXp zU|)*w5>;OJNS99dfuqVTnbbVe-^oW%ZqWe?Xb67?9Wp9ip*Js*^Ahr5p-TpAQ?xn;r@VyKzEd zgLfX>+bh4F#YIZ*1U*qvTiCN;o{cXW)e(Dmq?OsGwqB-{rPF!1;Y-8Mba2WIR!5V1Xe3Q`AFputDPD#fAu=mRnmMYj|IQ-&&7YL9P z&G1U!yhFKI#QW`lkPmQ>jWmUl7+3vNGP(WdwTnTotq&0iMk>$9xzFZ3&GJH#QHMTT>l3Fi!#EST0EOq zYP;74TkiMi;wN#{YO!A`vVWfkGKAE*u2`iIMQ}iH%4dm54oQ}Vhnl3_{KQGemoG7X z;@=1*Q-(6v-OU|w9sk?QCNJ>CUP)nnF1T1cVSBN5Jeg_A808c7y1QvHYbP@aE5Dfn zlMIRL`=KAkrKckr;Aa)2h25v+f(0L36EzAkzuUS&N@07z*#*~tx=`aL*!B}i{_Td+ zg~{jkOW*qAArqs!j@!fECjESCRX!C?%P^$F&abd*#zX}?;63%y<(Jz14yOy0JK=#4 zuXkNej7K%0!f5D+|oeue$St+t3eJ+f^h`DR!m0DuQpFx2j@M?EK=9fMpfJeACW< z6P{4ptRHQR((+{cta*w%7EOz!{#Lb>lq2fETL>1-JV_6M}odr-8oKg{mt(wNDMKsT?I<@#ug=`|qCDV6HP7mFL1+JF5ef@qX z;5q7ghALpIY{*N@oPgtH8us#72igd}R1dE1!t0SON)-qap8KbnPlN3q%&M6^=Oxm0ma)7C+1^B z;9BoL3M?K@f<b+oLhw`K!&^oou0e>F;Rc@9w1J3cQlCZ&KZ$;1RCTWK|7EXn@5 zWx9@Ewp5O;CV`3^Hx)zPa!kEA4eq*VG61nfFXLMreYIe6&&8W~D;I-l?=vg?4B%o4 zyI?_hs_=7*r~v2urHk*Y$d}}JxVyIIp)wt8FqR@p{LljQWhpOGILY>OSwF?j0QI|1 zM<^#$`FGXTDE_Z&Ui{Y#8gB9M7(x8aUa%y`MR`SH|i`niLx zisxJzGBMXx-`<0z#(1Zord=byp~0@_9i8^TfZkMr(gYA+`L|S+LJb&w{MK`|oSx+> zLv9cp|K!?T8CTr5Kyb+fa$w5VtVy=WhT|E$&uYO|9$8HCdnek5Al7!A z*e@?eLN4XO@~^G|R1DC0mg5?6H^6>?w?`2oeZfCqB}B{{Q)3;0Ioh_2gj&p|M=nS~ z+tZh2ol>b*4g$m8;_a3BkvR^)s-76MGM5Ch9};P5TRmos%d*4oF5^fJt*SE&nqh6^ z(2#LAK39!FHUlyL58ammU_Au2h7Cc!xH7=jg*;%{z0*GJ7A3(gz{LG~<71B=*%OxV zgKj8O)riToi4p$GBI=b(j8mg|;9*XsV`-c2m--W)#TD+nZjd*DYb45)#SJccrv5`l z;gZomt{TBDZ}ZVPL7@Rs>ZDYfhT-p97354lyHB)05B!@CpP8R7! zeM?)X1No6=ZWSsm9nsoh=`X`ja9xAtBv*9mG1g*5$+h3QH8R1;?o@5vWu)swSWIc3I{4*3FW|~^>#Tzh zQ#5QH@n_m^ zr|*3x(7x(?!$%mFHY*9figX#HhiR!AZm!HywHO#+hICA6U`z+tdCLZ?Xlq#Yaxe0- z&g4v=8hinJ($p`bEIaO%qt$oR`D^?+MpUZ$4EW+u1o!oQmg({bq7bjf&YiP0mWQa_I1NtBbt8;{w<}Q@f=qEQQ9<8Y#r? z+5)Yu;T^Ru9qy4cIf5C_2zWOGK5cG8=+k$)Nms!aT0e9@*``bsF1xL)4=n1f+w)t9 z%a-l3^_08WeQwMB(_k9QwUG+=8K3w%p%X-sJbbbYW3|9 zbdH+hu;%Y01a#~Xg1`0<*~a? zTTwdic3|&;mvU{v&&$dw6~iAKdYb9*a=M(v(WaTgg=yz3FmNqK3YX|nrhM4{)hm{N zTB@$?inhb3k11ChE>DpBMK2e5rQZxHkp&rmU<5F7Lp7lT`EmF9Y^SaqnH4yYiQYcL z)CmZDznir6apPI`q2%2Lp%YAgKe^07d?N5zVvtE}Zh+dmPPek)g2y+6B|R{+iq@ zGLrN#VdYzi=inlvgUQS=n88I8;92YUq0Az{)JZDskg=Qy!5*E>$1 z0sp=>W7sK)W%N~A;XpD$!p$V$aaftpN26&)1C$P|y6tfgK%k62O6F*XgTY1>?NH;K zRRi0)G&^FHS-c#QOH9gAVjA%u)er<<)ozX-HXKvxVT)Y}skEGg>aO$0W_?9Rvfc4E zxYGcp5Dj?AcKtNgDa;BSd!H^X;-J&}Wb1r9z~sOR5gQ3{o2^5xr#&TUIx0?89(Uy< zS>E_{37C6SpMU5-SKJ_vAV zCYg+VF_!wgz&^J`F$-RvU`|g)j3oR?na%?CxSq~(!0xExU4fj8cDx z^23*_omlxeXwh~%<;Tv#)n~y9;4{nHx9IYQMKgRdAR?zl4=8*XEVe%bPV(j3CjpGW z2)7Q1EGZ^RYHG04Qg0Ead2^t^#;&KNFqrsL)ML5HR?ThNBZ1l$XCQ6YxiCebw%v=g z$wQ*j;ttVHQ&e-mqqyI#lL}wP;llR`af(X6nOZqS2=)#`K$KU6UdR3p8;_s%Qo{Gl zO=O66!{L%wUZw^g2Fnf7s?<%3Tx=8N+)o%>RlW-|}9cGHh6 zyo1*|mZ-@_M5=Jw0v?C94LsYYX4;P`+0*pYgsZjd44SXQ=8k`BfBXO@lGnQ}ttn z$}^`Tb*mQni*t(s#)GoQWO$|afG};R%&FD*!~BHqjDer&F!9a&je7u;$bA}%y`+7+ zte+z0mrvESVi_w{Mqmro1B9(o6eLzekM`jJ zIOmbu0^fD`#;rRM_T`RVQ93#mub_2XP2Sz2Z2!~HC+>L$9G41H#e$YyAB$)L*3R$c zGx{hLNBjXQF05tQW~r^93Ni*($IcDn%v8eMdSh0Pbcs!-6qqdRY_fM2c-qoT;wc>1 zv6o6g7O17UK2kkgH;ftgvN`CJmwMw``Jni;n+NeU@}xcP3>A2^sYP=5Gzo-zQ9WE> z2j2=bZM#iA1b7W1Cis<@E<{Yj@<@R^a)O%g&)o$?VZg{;Xgpn+zZ|{u!u{7Q<@O$DZAS|2(0S4>f?Qa0&#M2@z zAPgD=&IA&1S=ZP&nrX|^{m|!T5&IHYTy1I4h-fx0udd99Jnf^HC@CmF5o!jFh-WyU z$V^4NLv>^{UnN#HO9<^Ko%dNRb8>6KMdDe_~DpK^}4^UDAiSjF#`a7o3} zWte%q#V!Woy_=^uai8V?QvK6N8{XH*IuFqK27)PWOW(GQ4M))WoDs(@cNb_@6(y*n z6>8a|(SNGe7BZgwbtd~02m{M1{z*xN*}VsWlaU*QIxD3Y-xXmBvG-TkH^fOazcT^$ zdm_(Gn?n3H+hmUTD{|wpkny3FBLS6`!j>2kwQ{uG)`QAJ zjXvs5nj(@0CT7#AojP>TYtpRdr0)-Z7`mtkGiv%!>~nFY_rW?}KjbrVmH;#wR*xMQ zuo1#0_kMWG33Wne-qr(FBpQ_BgT)K2JzAtQg)BFP0{Xf7+9-?2yx9S<+4% zT1~wWPorjh8SDe*K!&x>9y?H)=`da7v$p*AH zk}A;UbcIiRsqSp(N;sFN$$vA+#P}jaPP}zj0Hb<6eLdLD1dGsZ+7pxD2yaz>;!C(l;ruX(sV3X_j%tpE_ssG*N9)zANV9|6^ zIQL^F`wDc`Y31WGJe2>{2rkeQL%VXsKymNRwV@|@Xf_K*l>w0@XR4G1ZF2|GNrM1j zxO{q-He5qK5d<&Vhk|!485M%fV7%n~;lL=5^Q|Go^ClPb^Kx@@D_Xq2zu(xU^4X)& zdGB}uvxpNVbc|_&6RBUOF~{^Pf=wLXLB(W4{n1{PZZ)h2T?7x58aXT3`5vOq{Jf0a{pDj;kT8`y%cCHTl-4_u zGhyWPC3a;seJ4&Ms&fLgDDrYsLWA#k=YK+>S5J4WRN-XoBRN|yx6oG%1z+(6Pk-(* zobEDPYZZbhzrDJ7<{W&T`Gwq^vuam`a1PwzI!$P8i;;$W0p5a@yUQ_$6>5KJ%P_fe zE2GRIJNp~kSG%lUpN;D+3JXVJbUpIB#<^Yrh7L|^r!+GS<@HCxGYH!ET+SuA#xLNQ6>RI-I2M)-*S6}+<9I>X&-zVm0{<3&H><(?OuuuK}vAge%mELSuvbGGL<8~nfz zQ$9oT^J!K;VJ*@HLLyaRo-dUt0#|i*)WmL~+>_Pfd8rrbqD+f>T%aNM77)8%#5$PR z=$3`kXZ$}Ew3l7JXFLF6U;ujusnJdB$5oQ+EOh>WZWeRk9d&qGm7@st z>c4cZ=ZBv&e?gmHUeaq{+?-iyVJ%;`B8#~NSN$%kkT84Tx@6^%2?ie}zbrlIRt=4F z%PbYy(?Fc~J|=u{c->ZD-zoh}7(^d;nnb-7nXFYG15iI7sueIOPWXM0q)4H_n!#U~ z1fM-msAd9<`i&>S8;+Bf888`P4HaMhT?+`Mb`B_HGzHU7SSZuNh`P5K@ZzA zN|d?Z?>M_oI!xH1<5HPtEdR3KrWujx*v=ttDZCi`-u$8BB&hcCv-8GK!L5m^{<8~z z@f>pCiR@>iiumV2@w?hv)N34%1Ej5bq_He~7(G>H{=HlqYv2BTY@?m%3kx?1HC@;T zVRQL+Px2elj{RbgPX0xXoE9gI)QPuZgR=uA7pT@U{ur=u<#y*gd50C z1+cl$ejJkJ*@=!B_;!~JVmJPBcp#%ATe`M{%_Wh1tqPs4jhSiYusa;}u2+E}Y%2aR zFT#Xk39BcE=gKS%uJb=ZA?FD1#>~}5Obirs_NZS51_H3*EKJ)s&_=Pu&9-S5==7~o zn%lG&cFa+;e%<)IEy8$d`9-&7E0vs`;qyC2!x@i&zTlq%o0Ic1d#PdifF0QcXV2(& z4)`q{6}t+*Td4faT~^Y%at`;tV;>wJi@9vcpF4$G491FHPD&}Z_&;7Z0d}8YjzpB% zAN+0?&+As%7KsBlKIQad4N($*$dyeE;6>K!1vSvels3n9P)QtZ2Ao(Zp>!=?g$N_~ z1Mf9GfZr;?%^&xRZl1G>I@xxrIHqU)dF;-WtG+;8{X6LNusA!#(~V4X1(L90e~2V|3$iV%im(>#0Jn3}>XZ)Bo6~x;IwKP@EL1Icj7!XT>~zo%RI(5FP8- zoU0v~>u-+9v`T%jitVS|O(Gk*!RQ*FGJ;!_O zO%3CKZHA9ebW{@4YNBcjRd!?($jJc1abGxFOhkn$)1#Lgd8~4;Zr>l_D<|gaKLk<@ z31C;9BsTh(f1w@Kw)@(-OS<5~Sh60{`9b-i$q7!j-W2-sXg#fkAs~r`_Vm?fFkHd+ z@GS!j|0icG%Gu4dc*5!@$|GV7PwgmAJlCCIn%E}naOFhnUV;BU!VF`ny00h6uuzj7 zlYS@CxcvS_rL~KVj~gs1O|kr%2-|hWT`x2hXM;lP!V0+qt%fk1j3DEKE?HWhn-922 z0*@MoXnu;D6XC!h`k%w(@9CY_d(cMq3MtjVG9e!mqk7|0qp7 zB%Pn@)}1~IR$Jq?W7r#*Zv#c!3NccVPdcuRZj|%XmJ)idZ*L!j>MaNBQ3eoGnlVIT6 zme#*YsZQj5?GV*@rnGc>Mm~1DS%il#%a?c`(c-o73ET*f=~gxGcY6vEB&VKF>_T!f za6MT&B(+@DE18q=G2;9|UqM|)Ny(u1Z!}V*f{3H?MQ!e#NQ_cfP(**;n7&;tTUsOZ zO}dJT@7p$#;tWFyWpN<*j}li5=c2->VdW^-PyKv;Jf4^;Z&cw)ze+vwnfeF*fH#b1 zS^}8hisB^q&3RUSlNKt&p zl5%~4JINz7yMI4d;M|Nmg=$XuyaZk!s>1O1A3dJSZiF#B(y@sf^aktXQ@}X2*O0wK z^HS%0Xh{d)y_#!`G(H;3$5)spjv1n&O!1zV8Y(U9azq+f0@fsm23CdxOL66%Uk8VpH-1dy30L{Mo6QPC zl>mU22S}z<*$oICBReiQ^DGV2#3j-x{mX;$bgcX<>(|Gx8P1llsKl0jFobP>*SPws z4RsAWgE+}Rvm9F6ZX~f)W{(avqvWfJk_C^guHK7uUDm7u4p&eOEbN0Q(cpPul#wmaZrkk8TY6}p&Nzvi2zfVJ}zRKkwE`6RewNA3fp*%dIq)62EL_rf&d;*0Dm z{%m(V*4!&F{@3xF$`sRcz&tU79^E=iSh-DT zf)qY&c(}}f?U=5_ulTmfFrZm5Z4Y#B)>u9?=tD>my%D8eZFx1#^m;iV-vc~Jm~92t zqF0LA(z!rr1|6RSZV^va=C4U11ig1M6C$&k4r0l*%Ea|pbomWdzbfczi)?qi?u6gB zma&}BTNqBXomzi~@dx{|re0%>WYS-->4{T?|CSzfbY(hH54-vI3SbN|i?)%G9AIKU zFLGIoCOExwW?~^c^x99m$+)p*oG}4KQ(i}ZfJBaX8gDVzs!)z%Puv5Sg@m_tAXgOj$B zz^-I{iKUcoF;1((pM!GX)vjgNZhLa%V)D}1xT-GN1eheJl5Lg zi8+pV2sCAlWYQr5$ndJ?(-x4R6L(NeN&Rw?j6sb(rQfDqJI0Jh7b>HbGNDX+pLkS{ zYp*9M%SERgpddF1*9H5d1)cCB+3bd_@_*dLA7&vMTR97Q-F)jH>q8g0mEZn|cT#WI z!(}M)rI*r5)j}BS&*Iw^KgPeuq?jq+`uh574XYbUb@T?w{B2_!X_u6k?hHY1^BeIJ z=L|GBkUM`&WG|t+WwWnhYcig=Jk}Z8?t&s@{)JvoZ{ms9 zDsC_8zrrKhZ&JdaA*}h;J3jUkZbp9<6!|k?{_v|66p8J^+MV>Ye(tjQn!VKEy+}1uCpBHRR8pE?t4LtU6%D&JAN-iunT+V<$~b1WQQ(bM(ZLrHlEaytV)-npKz$n{Dzu#u-KEYStMin<=5J zItybE5P44v98&h4~IO2ZhxBr%-XUY+f`#@-%t zk3%WHA#D?eaPswTvN9FyLmZ*_!<-{2WjbKbnTz?*qer#k^DQAif)q^UJ(>25@59tnr z)^C50@HD})<1fgzO8SOGb+rMXQ=c?z@%@`y+-3UMO``4>UbxKdox$krx{Hg-B^>qH zic?JGzXHXmf_2{q0t*HlX#To958mFs+ONDdBNYCIdc#N%eW|s!zV5rcsCkvZ zUv?{W^LCAEIs-E9y4~H>Xt-LM;cRz%Y!v!H1pW5v59-9E( zsfzd5DkBN(Dmz%p_MJ>DBKD>1;~xd*7D4ei3eK8PNLl?}T0{1tBfiIM*$KeizPsl| z*3>{MC~9%8e=NRRrZYYYlSr3`PkzHNzOugqzs5|1RkDP4ryGtjFCfAYt(U0(R!D~~ z4^n*&7+hacqCmL3Rr4YHa~RNUZIQ#8H1WCaE;pcg>K79cRt&P>WXQ|Hq+e7vQmft* z<-V3!z3h$sZcFBWodS|624eMo@F1{O62;5x7UCL!=G}eIuB<%z6$>z}bk(MSL3tSH z96v2(&zGF$8RRaN-1aCZ`Yyh8NH53d?X~M^g;XTN^cHAz{19nP`mjY&ZZH^1cyJ)J zg4FN!gh=>$F=zB6O%0`rKz!hR=UUV$0(DRT<~fe}lgEz}m~=u20z(?yUXR;a4)kSW zcyf}B5!oGYqxCrZs8j&#jX=@46<>qL44k9O;dqoCLvyJwrJyOpEIlXUnWZi)p5w=E z{=w}!;;%HhO*%HLS&mN`Rh_a)a$SwjwKXk=A^7?XM{yga-JQ=DjY4&Q=uG1Fs`D9;_{gY4g{r_levptlWIa^WhicG}vji z6`VgbSA*-lWY}6#?TSQf*gQTJpc9{FVYsV=O?z(!HuPF7rC_pP+#Cs|@f!Z%B+GCkuDD+Hs%0E_drcE#`>>SMc-qu6)XVKJ&0nil%TUYl zWh7LHzpJ&>$)Y$xJ@LtmH@&dEgtR#+tLtqOYm}9sfWYd}e)#6oiF6QJXj;!3?*2QB z!PQl)XOl2KvI)>jB^^YIivD?qf&Q@D83g0ETklnp5#o)6M&O0Hgl`3}Y^p|FT3sl9 zp>6OZ zC5vfBWKh57-u-ZYNbCCy9|2bR!b_l=}~Hs5%5`V|r_%TA1wa92Tj?0C&L-Kg~O?X!K_k?!NF(Y~J`7voB8E^xx|}xD_5(p4FG3%AEzUG zZeU@Dumuzs`o$^&G!qjCoS(%I%l;Om?X_b|5!ih0RvV-kDDR`Oj>8j zz3aIax=Bf2?5SlB$;G)D6{H60g!^`yC40eRG2V@*XY#OB4$LYb{D$f<{v-7ZsqL_# ztNh6B7g)06$?BS1MoNVfOw(^DJ=EfYomk^ueEaC^B(SE*?Un)5kOwV2)2xFAO`YuQ zs(w_yF@GI-M&lO$9A-zNM%x%+SDGUB83b)^a@*GU+wQU+7I?@7?=urjJH1<^QYVJ3 zbg58a{*_C~kKRYSa>g3HoV=%V%}E4l8V$UebU9yX^!Wg&=5ZNG=PPO;@GvpfeZ5da zG4SVg@c!BSIM0Yx_pjo%%haquObg1cf;2#S7RNL)HC}U zn*G@Gi$tniiU*{&pof?^zr^yJ!N$b*mxC(2VWmm?*%N3G-;Di2Te_5bV1f~>`+kHu zFvJ=(4xYiGxpbe$se&$ZxSeP<95eOP0p;m!-WS}_OlMbMBvgplJZ5=$dU8u(^6AgN zsXSa|XMjjo_7WKtHH7_YnY_*X$PrQ>HWD@9-_MbJ*StC$ARn)E%|o6YCK%|oKY_~f zm2S^p^8EyWDdKx+TDV)}!S+t8Z8y_^qe)}v%aO2R|<9(LNli?_Jw`klausIzDvUBFvRK`Pn^-KNqQ!kQfV~s5ZRIRUXTn>> z4JkU`RdU-WSnR>Hc|b91X~A|x2cvu>ri*BIp&dzO+Fgy`f;sEFt~?a9%}`F_3nrsQF7+jZ=B>Dxx=& zU)={Eh|{Isl;XU(5@d`wTwA8`F1b}9xuc__qy)*)!GC}mjCkzj`01E2Lbwh=zA`IrP1hr-g9?6*4pZpFqW3qj& zVfFFv4ZBZgQ*+2KLVJJTuqt|ru}Y%;SVM3>FKVSL3UN->x3}501klkDtHG;5s2#nd z9K9!tfu)I1LuHUfwdCFYn@!-8nKZq#`q0|$l$Xc`Ig{QK!MS0#Zq%XQ~Z$}|iBgdJubHJKMF(8Vqp~q&l zX{p?LLANSgGkhjgv3e%RvB*SlbZ>44`MC<-h1|XT+4*HWWh(D)g5b0Vy>@|rgaewvilUIehBXH3F;);n4 zr!~zI+2~ihW4p6FvAQs)ELepS;bXU~WRGXcpZ6SLx%jH<%HkWpReV0L(YESemtyoD zaAf`IdRIlJUT^Hme%5yY1fcqbVG_zof4|40n$Tz%8exy^I@ind!B3{_=z=Ac}X zfqApeXcI&9TinOjOXGWO6GBv~Ong9Z^UVX1i-FP8A(y#KCF6q*X-+s-C>H3GC0XGr~@}1xNGX zr?2M})ja&NNXi*9f0BfWIsWV|1jXEq|MovW{c}9qdv5exTmm-G{{L9(5G6AiL52bLmZetnQ0cwMSuB z(*(O6iD0Q4S*Zgx$&Oo#d(LO%hglHr?5)K!W9j4xYirxK*=0Eu@?`(-^Mo zJ#(Rw?ND>QzMG$)kaRnvB5!8_N=PG<)7Zb6*ZXEqF8j`bs?2qzG>(1m7lzF^J?b_U z(}j}n@nvve<94o9@WZBHtA;o42V!EZB)|)LSeXe4X;Q1rSs{T03yfu+;1%)Md$$7t z$gF7xcO31BXX^Dyw2qN}(?Z$&Bt6hKah4{{97JMh5q{>(LSS!uf7}rYX-)tl8H+AR z@9@DSo2!&(0-PiRwub@&BA~yY+3YISXnE0$Y6yN}xQ(I;C-jqV(oQn_4#nOy%c6Z@3`2}jcaLVY+po}dOL0SgfvCY{*mo2LK}NB3T)Z4 zN^tj$HhI~WekUlhgJ;K*`MX_F0!Ih?50AojMITPepCrp!cV^XSR(J4nmNre+#-O*5 zw7-71;Dz~9!>;V~H=G+=PmN9>5yTtwD zC_!3K`b~e7##Y@4=k$yX`qW6)lGC zW@vCTi~-}_)LpK?u$Lqo@#C)9OVDfi1BH99h2u0TERUu{AfxS%`r!8N$H(L{-eS_J z!ES47$WE^(GPqO>RBQWJ_E}g2Mnc5~)NnQqGNF5)BMSP1P6O+Wn2-Oym18heDw16! zR-@HZA3MSVu(H|LzZ;`Yde{8oZ}18x-0)^znn^60gh~%2^|X<)Ru!8=^qmQK1E=?6 z=ph=}z^5vlpqcz1l)JhtbCTwo(aSc>9)^3~7fruEg*3N&_JPLgprhq(sYU~r^I)p$ zJFo4{5;{WEosyL70DFxk_z8mVL@GbkjZcM((qqPhn(>`&mFRo9ahro8b;}0^>SOhk z^?ozl6>a7+aeUs+pIHB#>jNoR-v3&KknLSVH>P(BmNaTKuum_nX;Eo&E#6CT$m&ezyD;8({vVT>ITwR>=7+o} zBFib)6~M@gkb%)SkhH@X%ecMA|K_W^jwmqlI?LIPw;p7?zL;)vN&xC`&tha+(R2ab zawYYXnV(Lz99m2e#8Cs&VZON8yji(N+eNP?>Z)^J?%R-S0Wt-t`jele=0PB!5sSWy z|5DMV6^qx-iznDFM1_?g8Wvw+;-8VYmfa8Wvv<>y*kmQZ{n6BDLe?;1Kk)9H!>os+ zIEdd1QRcGelon#KU`YwT(=_qPZc4XgNPwm>Ye2I*Dyg!y=3t*tXCVCjnbX^$RqEfFzCpQ2 z+>Gk957i5bIn&|10?0g9^|6q7oG7myuE~8_*-ZP}Gn;jN@yW zEKAeeY%NX=M!OZGSxKmzr?BwMlg(XS@iaMMTEKK+Hfa}GP-F;nDHSJ>1P-f+a-U3E2MjkSiV;YAUMH6H zoeS6OmNR#~@{AwgzZM!F1Ae(WUR!N`2(Ry8^)r*MM3qm_)WLQ<2$-?$pMN6C-#$02p zJ6t48n+LZ9-i!?!?^uKBJ@S;NUF6|bXG?vhOKg_jY2-4td+JRv^djQAD}FR1F>p>* zt@`1y6SHFd)dAC7eRfT^tKnbFH9Q{0Qtq@2!s%*`*|hu3g}B>`NAOFa|HD+NA%%J^ zSmiNzm;~Sk`uh==d3rJ5an&clp`E^;s%%u@V|m>;ZG%sm!KWSZyeYn>>BKyD-anPd z`!gbs+LHWN9ENKT+c=Q@ae^JL(P=`nU<#?tCB6CKXzQd3ca42wYHX{oNmVjXvrJ;(%aW zmL=e4%p3_lz7Mj`ERHO->3HvdlveuYz2Wl@LSeqHiz9PbPuqF(50ChoNyaT0pwha- zQRqzPzWE}h^76@jCwG#N-oNYS&7|54nvruur>$EOa2@2UN!34lXGdT@khvfLNeNx;_Je6AU>Y$oVx2OsW$W65zTp;pNOax+u77H@29)nwW9kMo{hPQs=|tY2d#5CYo?j~ zt7Ck!(PK9{1P89u?{Hd#^V8yKn>;f}udh=p%G?zvO#zi0AEp3~J6m06lt~QYp2~ny zo>v(wtVV2H`hIS_QR*)7y}7Ek!i4I}9NTzhmSJ{2Z%#T38%3 z0UgHs7hW_T!r7ifU&9IIT6>tR%bb@;Z2CZ1U#lOSXX==Vvt!=MNiCz-(#Y9CYVm6R zK=%D#h|$1-4*w>U{?~wG*cf>^yKjYYlOD~}@&598@wczXYpvM3AA;Q{2Y>sRIB%;J z(#5MVzihxlKt5|HgP|W&8im#f4}5TAK$1l;r0x=IlV_Evqjb)}Hb8cMLEZYEwy+}5 z(h9YTCyMPXXIwqdX&QuP$3ma78eMo%D7FT6aRmN$D_BAK7L67ID}WWZN|TNg2X9UO z2AV(!uzRRB~M6U8BeKGUuJ4@JX?^NGiI=^Pjzn?eIm-dh?tz0Y_4L@J_1BqAd= z@$M0=&m^k(UOiaYyvo-pqK8!CJN5s08vlaFtD8T!djR=c>~~$Aj-sE}`uBbrnS_w? zT+`47wQHM>K=vGkB@q9nwP3afkrS=8_b?bgLM%$)tBqE+=^>h3>qq3?JUSzH2s991 zW1ujd?_kyRw((RgEIy`n{|&!jsnTzSsacb&EobL|mmgi--5belp{t>y-XuL&HF*q1 z%=(k)GBt7Fp6s9UTbSpn!8H?gEcHCnZdpJQotEz@2mUeIw8rd#!NfN_8sl$4Ij+}#LKc-_Ihh%fx1IC z;-`jf;6jEq>_-~#YhF7Z;rdQl-MgMb!vHVB8@+h(Q~j41ly8lvfad3&8r|yE%=Q5t zBp#c75~boaRaZ;bCLfvGe{NTi?YO|BScW5(CX6iRV)lNH(M+_nL>^$ESDU~iUQIE7 zm3o_n|B+UGroy~YtUV>yE*km!agnZ>+&H2mV!iZl1n2iQ8=v^K-9M*7>GDYZ;vzng z#8g>nx2v;Y;Itbbie&MUsO|1l!#3mm>j0E$6a$~$@jA?9CGiuDG=STTQ(9W&_7 zs=Lz|N+rdyUjBs&=}V99rQG7HF4!jay-w;N^g0i)NP7O^xG*z$0+X6WusNt0-Mjs5 zwC3YYr#PzYS#1nOwhV#Tl!OaUza7-PkGQb;NiNmsG=MyIzh(H1RJ)qi+g!HNtryrz z?PH+5@L8%A9LMffjcSPVov8O`wT56b2h@6B-Kx$g&1r4`6>Q^S` z8|yFDy!-At8V^SZ(U?3tKuMC$U)Y6g)yM@ks;ZIc8J0mRcx}5Zim{g%_TB2*w-mWc zuM<}eu+g+!GN+-h8?aeQmbX*T^H*3;FMe(F_UNyE+x>mCSGkEEeTXd;WH+aG@(ZlI zut-|w5Jq@s$+(PivmC>CPY*DRZ5jb+uU8&;+vR^;T-*i)JD_W_E=H)?hyO8ozwm?Q zx`~qm`r#bg+SVrCTrPO|109}TmkNy8_MET|Jqi?F044QSWx$=!2Q)U&?nj}{a@g$~ zPnF=d9;+mG95*;DuY$VMwNA_plXipgJ;PkI9;|IepX&;-Zb0k4=rcLn;@XSx49+5j z_UTR+s56ymsMAgwtP}@%%r8e-KI%=Y-MIA8QVWeP;`{o6eYkvfzv8c51LY`DW0UFl zX}6SxwnjkzDtRlCc)H%cPxhnWkzgFjHN~glmtND%tTqKackHjJBi)zDd&O$h9K@m9 zi1OW$(b>8!X8U8!iO@{Eu2}X0c~Em1H1=Kd#9O&G!w>qMrH3ev^RU#=^sj`oVh#Pz zV&T{nFmJKtZc?_1QW3PT)EcV1fHlGpNna24H$8vU;SAZ%^+lg-9PrZygziEmO-jN- z@rAzi009p%K!`BcQ;>NQN(*K^?Irv`^rh+c6|DL7a#EP>-{3lR&)Rj!WPoiZ-11B! zYS?zdpy2)&ia&*~IUUMifBgVWD7w-$!AyAcz)u?K&=hed*cJ~?&vMk`ba0Td zx60JPOd+Au(hGT8sRsB}U7?{@+h4Y$gB~z337-0>L5Q4?=skqczoZ?|;9iCWw41fJ zf$ix3>97vJQkt*iU6r1mzI2+93Rqx6mKo&wkX%C>lg?{coocTmvh-W4YKATHL-L)| zcVt(cgO!M>+p9kLE|5|uf^v)Eq=&dL3tao82ZDl#xem4y>W3B7SI3hfItroc$jwO3 zUhv*cIu4cRtZ8L5Lh(c&T9kL;SudL@h4^b4irw*=Oubv=dk~cYh$2e%KWXqpv!yW< ze_@SVD2OC30r^;|$M8&(^gJrwho{{W_mhA5vpHf4Wt&VKskt z@)V_7J#AT%D@bsFjhL$V4Yhr%94DAU zE6e=77ZgGqjKo*Cf2>JdC_c|BL|98kz;4u+ytJ5 zsNMyROb4D;sIcX65x^AGp_v}AK;0rm6h8Nhjk1`Fj1?i_h%oV-EaqBGsI zG;dcNxkEu*{YnQJJ?0Mn?HgOP&(i`g*P|ZOSP%k0O_Oz!P}^-0_(O=6%YZK(QR{~j z!&?qqPaJmWLftcw?XE^o7!-BVELI~U)!3yXkX$}%s0GI`wwVl3bGINK&Mpe{*=IiI zJaH6^IaUTM@T^Xo9CWIdt>!!MOw9|^5kOcCSS?B zjv{c4UwMr*PZyKsoPA>5aSq}Lb^_iXVE7~6SmLVxWEYIM$*g0<7E;;k{UtLveRupP za6ZKiL(PbKDq^q)A};v8-?Vb*cS3E0n_YM{RXtC&4uPnse+CCsJfsyzy>h}P__A1WZBcV0zhDH*8Fl4LV*wJbue>JdLy2h}rl^14CL9{=1P;9Sm>F`pH0WQMgC{H>&`X> z8n&-;k3A8~FL!KCBm^_JW$ojP@hl+aK->yP6ju}* zw{FBZ3m`CoGQvT}8TmkZBvfpYZ3g7f39TFe+@rjmwA%sHpuz9r@89Kg@Dg@&1r@4| z&bm#$?z4t666$YUxOVCjTWICTDrO8OQsO9eTpILy)33m$k$=?U(xodcrn$aJeOnVtYTEaRl5Q z|1RX{CzZH-2dxSuw}}hSQ-UTC-^`RP+sKUGBq*W2gUB^nJuN~1>(tFVA1&!_Q(Z^t zb1mZ+KtDy4Jmx2-ml_)gRlM_8m5Ag$i8B9jQ}ZRGS)S%%4no4IJa+Nm@YqVah5)utvr_OwKPPWrrFW_toY(Kt`_3E=EZ=$4anODM=xW%P7Yh^`+Yqu(mlF%tD?HYp!zAKwm(4)kUZO84jEKJ@bg zV(f(x?&q`dCro>w_B@WDYy$=5eKFJhL5QSYtQhJ?yE1f>Ti2CghyrbR$ODqQOUZhC zOlSy%3lH<3=XOnm{;KC8wY;x?hf~I(LrQlqaDC%3Ir?MVBt;~SqHqQ zg78ezngl{>zqBYRkQ%=FY&ZBDxL*JBxN+ZeYYhIyq#*{_&<4f^{}Ruo$=QG)j3LQv zKYv~Oe&Xye!Mr#}2g&bD8UL7PA_Pe{iWH@OEqK`7!RAg!@LBDK>c22ox1pfY;@KK0 z2~XKFl1>ISS6{Bu^NhoTSKQ)6L$ks7UA{q7_R_6zu4YbIm}2cuz{#fG3Kq>kGhpXk zG5X}vu5(pt)|Z0tm@7V8DUC|&1+PUJT+>PeRj*N-NB2FLQ5U?LNf&cfa8@c%Nl2wj z+Uaq1s^p9^BjC!__MnLzxSta*dvYiRtK5|Iaq)TS7kQM)q5Y=t8AwK|+A!Td%4+gs zRMK=|$0!Zn7d(p$kuMAiFDS3HG>`}95&70;hU#=XpHrap*4nn;hAk*6s~%!dn>J&9 zV|4ZOzC?4+gnXx$is!L2W%!zd$~@(-U-%3cz%x&YM_zcAjw?1}gfVN1?YllUMC4nB z@Ea|ju;0uO^Nh$9P&l2C)ldQ;u9ik>SSF(~N4Ug-BAV_1CmdWyVW~szxs?!?{3VJm z?&P>{fRoA|`gUGydCGV7WjM&AlJ`IG-=)+|)!>^z{{245CJFu9@kYW%%Xs>7Yw&HG zfp9TWKTv_y_v4qy&4LLK3+Z5Xud>gVa_1I;90-@o(V#|Yu#vg6i{rFc0M-!^R z#`|od5t5e7*={k*HmHBC`dVMEqHe4rv|#cAdZ@5{o_Kn}$2<%GIx(1$hl~O%Ncbi! z#j-y=BbhINOra^w8CNyjMe4Q%;ViAIg_-Yew$(r|e3AYcwjaSoXJr08A)rxlx1#Mx zy0`gLUJe8=ND3$Yr^wtcFFkT=MtSS6N^ZMM4m8F(d#>Bnp9Ni6ghHfwcmQM%5k@`j z{DP`aa)>O7=8u$^N`xL*!5#J-i=Pc^Q#0Mwz4Sk{;qk%?e6*iD-v6xQ72 zgUX0PbNBpgQnT%oB! zjvg8Qoj5)rLUf){_IAoWnsGyAzgL>mVGL2Zix9%GwI`*^?;;HuBj_p4L+I13@f^_3 zc>zXMx46ISiYw^bY~T9@{!6+pEkB%-kz1|2Sx2aJ#HI)lSIL3|QwzuDzm?>M+UY&z zub8ib7Mh@bS)d6HIXlNE-C=*fV#nLDP$n2}4a14fqhKweuMcZ;xl2MYc<6p3V)5OH zsp_eA<7HUuwHv+b*+Kk#DP*;_vlE(xU+}>0XWbk4mso}3MCJ9j>s1c_^s96S+abJ}!1Dk`-SGq0Q5n)Av;}?- z9_|)vM4a|Ze*=Xe%t==km;loxokcz;(w_Yu2_&BzuL7OFVKH+5mt9vX2yk?3Ka{De zIZJSi$mW1lRGkjf%r(io+0j?r7z&q5XBHX1FH~`kg9atKdiUM7EDmnc$D0`||4KK! z=C%^O868HF($}@bq8y@kH0#Y=d49CoSF(!>3JrZR)Zrmwh)!$l!Nm@c-L3F3o+Y5w z&y+)?L!}Y)LJnO%4T|gP46ZE-fI!tM)hd=^04q$Rb_l$Y^9B8FnRkg+1Q-DOH&GP0 zu}SFz<{s~P;P4eWMGNOJ>PN)b=zK!n4J>m$%4y>6JpEB$h&PwvE*n}MBCH`GefiuaqsmNZ!0xtw5RoO7u0b?B` z5qJyNJ^_V_-vE1?GBvVmf+CxztolLT`6?~Qi3S^F|0P$t=A2$HZi&6@1^7x%dI!bF z1>LlX@{q3}i2tYb37axd*T9b^?JIa)AxylJG0n+3pkrXDMvHP0+quTaH+dWnT z_Qoyp0t2G`DhyBH-5qRFua@5enEN}|XvxLj9ix?6;RnsjlEeG6me=x9qhH`#2e5@O z3~QUck00lVVq!dLp+1zWIgr*qa75Pd9{6-A;Bz5cq{IG_y_M|1n{x357a`6r*Lo_Se>As^IOvY>QNWXAbJ}S zU4D2Z+0{ZUBg`QU5HdUHUo#Q0TkhtcL#n~5$}@p>x>DU=ehv}>{wKTHe7{hk`10%n zxTH=(9{$lK8@{(^-E8V;&npoA^D+g}YY!RC1mw;e;(07=D&+A)6x32Jd1jzd+D-kesF`9C=^0 z6lnt7gu*#zD=_J3lI!mtRY2>T%4GlRA=zZ=#%Xlwep;`t&P=Pe8bSDDpujA5MV_&= zk!=iCe&!nw`R?9!p@#l2PBv!x)9TJINUY1QKTRV8gTkEIiZYK?FKy*!*7k^GgGfE4 z>D@CTs{ePYFE1MvG`gFwroku$!hL_GeUxOr#q!5t>U4>RY7LN>s5F>*S{xH%empV~ zul^k77-^$j-7LepBc;nR#vZ4d;uP8)?dRn^5W%bMrl%a-xMfPn=r*&u*s!Bh!l70( z?$k@!OpWc#Nao~$?$5p=QlN}mK1Zr`Mfk|8H7>wX;JjG%tap zH5o4vIP;`3eA*wJY{?(M?blT+pyn@0jE*E){2fX?!1qszNpc&E`b-a?3x~O#BqAqt zLf)da`ZxlSr|ii}a)Y*$nPS22wOe=n&CQwX=-anb0XsvNoa%cEfBi0BJ$4>gWYEXr zXERk(d_Rm6ldeux(gO#Yv}_fh5ERO~h#3;f%I6^s1MV%$CELiLK47SW%U@7XOQ5sM zbTztR(8!x_`9H+6Ie{h%wjZ#R@- z>x#MvRE-u1>7^(puB7dH$?ODU${Yog$WIH226QbW+f@VO1}|orO5SMY2J3!bmS+KB zY*_%H(PrK<<|9JIEqU7IfV?QxFPtHm{vR4M3hPYMzyU#Vy+7Z7IU-}VK`zenG~tQE zi?RD+iXAnjFlc0}7t%Szsfa@cG3?uaf7uNvJbG_QxJ8!n2#3_k{lvSw9Q+YXad7cW zIdoe$BLe-8_dU?t&DtG~|3y4e+WCQzF0)kUizl~V^~k5Q(*nqPvik}s_G9=Pu+zca zFL!hj%FI2W<%Z@156hk*dkZ)dpBXB>Fcp<zBc=(#M%IRUZ(`^BBVGn?`ifY|v?3i-ma& zZU3M^Z;9A?>I^2_z!ia_Hassob_v4SdWW3AD%IlYc-TJopLm z3?a!I8#YxUd~0`zp@iKyvb-AWDB~`-W1%hX5sh*M8;zAp71p6--BA_TiA2-wV3Su! zh#Y$IRIGm=#*A5M+)zA|@>%yA>jsF7PNFq4v0cJvorR&sa02(`H)=K1o_lDqDF`

&oWKYQK>4cig7htQ?{A?11?k18 z=GfRAfso~C@v!K*O$6N}(pZ99To zQ%CF=jb`DL<-!J)I4|7d3v$s49UdpgXvJ`-MN?P*>=KLcta0+E5%942TXLvE!3`Vr za#7g;Io{;gA58%Z9Ks%|v4mkEAvkDqL&*(WL3CXv3rYAvZ zxLUO(<@ytVbmz*ML06JuQiY0E6%7}y*&*cPS~H4BJyc_qFxf2t4fD51IgSZKL%c5@ zgEW%i3C>;S|0!)?@ZHJZ1+jX=TToOVJ4t!wIf5VI>T9gNEyvL(ZB~JdwE>MDC|T1e zl|o<%$Rts*@ESPG;8|IBHqrNet*;ZQy#+?14}Q2$Wi2lt(FXUdXKm39)WcbDI`EXP zWJ$uzc(P%t_=L1KxAEqZMzivcuTj7({~E6zRG(XY00i|W`e#$wi?{M05&TAuz|2zp z#)Gt)VV!Mj!s>qvbGChMJvx)3^w{1KyUvC#y3Uejjb`U48+gBr z)zK+L%A|>H1p>%rY)mD)v-T1yLFMqonl91h zylp2~>Mp`-ePD1F$&X+FH7JPIfx)y~kZfm@1Jx`rn~&^S{AtinsDC&k>?hxVRI<|L}j@S97VywQSh4~-{($6dk|P; zN-)jqN@fT#no#ONKGs&DDH9Q8&IR^*kwFvgnVZp!8QS9IWH+%bF-2DdCeTkz&-%{@ zKcTJ63Uu-m-$VO>iM)kK@ev((JeLtoj&F}X#W}tT_2CNj&>L(k9|H_`RGIm!Er&(E zg%qnarW_|V2@_K1odcY>3?!W9iei-e*WM_dtdLn?6%XEU+3WHZ!pSEOSzy)ID|w~p z6a~sgS7Cc-pswyWA3DCN&Fl5Uk%h_uIxTb4}BHC$Ke zL&@w>-e3GIfms!Ik1W3VNo$by5NJ55=`H*2>1Kp5{R%V9%@SbBQq^)?Vf^Yy=J z4%iq#(a`o(k>EpORo?Umq+_mh2df*u=)6|XRug@B^8kq8=SWG}o;TM#2av7JgGWeT zAIm#lgw%`_y&!wG@4>GDH&OEoA4ie0I+4Edn17SpLxErYDMpJ;9w-F-)wJ*cSg$ZJ zssh>_n*SRB=B}g_Z=d|l-E05cJ@0wX$K5^dPGU=o zGcic~`>n4{p&JzVsVVd%K2d1%qk3L&awtvs$jgF&Rd3m!YQ~?`TtNc-y2NjJ2fvFF zedZMp|8>Op6E{`Jw!b4kyuF-49}psaa@Za4Dnlq^EZD8qO*^95uq9rRVd;3AOkw<` zxnZ+gDYb%FKBnW#ns?970dmSv)+c!V68;y>dY7xQvwp{(uuWbs;;UyPJuyU)1&ijY z#dx6e;z z%poy*(Eiv952eY-XU?L<%xA8USZAmnb5V4DEZtXh>4LrywRrc9t;`dWOK2n#+!m!wwSJWMUyO-=Y9 z0q~xCW?*6K?D#C7NRgR3!`(XV`uAC7O#meUsB(h&WoD$NU2ZL_$)_rS6S=j=Kl;rr znZT6>n{V2&DCCCt?eIA|oq1^p+}{hMbCfZV)D}H^*59Vvt4E|IAur!bNIEmnd3y#N zu3i7G%ZJ$)9{d}Gr!+@FD^pMUk6B7Xx{s*8|AAve z(1VRUHLar$>cq$YtMLW_?@h9S)bOgPt6}bZ8rXIbDvnzT7Ak;A1(3? zHwbW+F*TwoH8H{{@f*_}+lf0vHS+Faa&mGn48G4}P?B;V1PSm+^8iaXk>me`vqd*9;`xL=j8ajTd6oMO(DfB!NP&xi> z>h;=cGFF8+r)=}1Y#uYNcNQ3_@Pi84m2Z|me@-Wh%D;2nbqA+Zsz%e-O9#Zco6pji z6@Q6<>AIe{w5l0dm>5ZqCI%Q)0z$5+Oj^2azyk{6PRT}4^hblT*}ROrnwfW=Z=BYD z=^B+z&i$)04hm0`%yfyjgy5J0__$a(iFSK!f3h(;YGsM9P|~0txGS?M@y*O}_R+Ys z4j#hq5iC9Db$maQnq=}LQB$7hGhFV?oeXWM>7Fz~0TcPiWHxYSA)y2~!v3}=n(z-Q z672ZWk$nRK>WN-u-l~7{j{xhcOJyY5C(yJi4WVIC9VDwB%8N}=oCLg$jH)VLT@dD) zRyUnzQ>d)};LZold~8W?pSjIcBbA4vQ40F>_nKe2shByQDr&DU{3VRW6ls&GIaofi z;;Pb|{!$b3MEQnezf$A=*N{MJy;$+vKGT$4t;EH#c4eNNl65PcBM#=Vuf<07_#VnC zygX!uC$yS0uABGlR5$M2Q@%$&S1ysu>Mgq!82Tv=!WkTmgI@lj6RTW!t(6+gTF*Sq zCobbNQ4Vzb>zCm0+w)@M(+kV|la5uU{v}6|Y+UO1-zhI{9-hFx6#6GNUVDWkgoa0@ zgL}$nLn6kB*1(S(MDBl^E1!G#pYLhy?Q-gnnbbN$o{#>bpO7oY`7qVHsgaBJ3TfO} z-4hzc6*Pb5n!FExJD;gLfDU(xx;IY*i+tc~`<;ho>A4hZPfz(*$BxEHf~9ihX17D7 z$QrPKiM3tYdz0ik+%{=P9jzk*()+F6tV~o&>Ck@W;D7J@U2||D68YC2!U1kgeeRiY zWR5AcHGNvz7ul_NC(8FXt?invbD@Jwh3(O7cKa%RB1#(ju0>O%bQ0qZDM`_9_He+q#nh0%7>3sxOwi+-L<1}kz`!5 zk|SVxZH*J;0E#D#&E41SL9 z(Xq0tkZy{NN3CJ@9b))@`N2;gbb?1iBUeYWQ1~&3 z-SNi0*uH=JALbSP5g--M|G^XGjMP~eL#l@NT#@O0D0S-5|Ck!q?FqG%?SA&^%<9`! z!h^JZWt8%2szKgrx+lQSEA`c*-J?gO#f?<^{-l*%qC85~^ovK{vQkJ{o5(UbrcSL+ zL9_cIgNLPm$rO+=PtOhC^!0J_MGj(El)2nP#UF+Vdb^DL8lTdMP@DMulbC8tp~9X} z4fNG`VT1mfta4T+agmbS*%x=VfINw$(*J8#(cRk^Zo=?_~8C$nwj^9=T5~;;0 zQ);NOOP;mxOWFp|vtAQ7_D95~aSk?TwL|PbJD%vQA7|@35&ti4+`gUW;#%e;;zYjr z2`*Qo`q_1ert#%kV$5XPM91ApP_h$ym1D_|OIxjRl6^3uovveyM40f^Vm$gzqp(nf(}i*OEE1g?jC;mQe1rE!AM+d$fRkQwl_<9QDspn7b#IaRtYefzBuDH@SC} zGxWNCIT-LgHYnjVR^L8O!M9nFdu_t@T(t=ql8_jHQMEQfH%IRF+@Iv9wi6au8v=;E z;byuxs-nTO)W&FKUX%7t0iPQVMvUJo)r+v0vFv9~l}1zz1?YGz+Rca`AYPP6$L$ZTDCnYN+`3x9rv~D@ph+xl(kBMaBRft+l!VM zZ=sN@IuE#4u(A_kCdrUqvHOwS;2_~|(i2e6^DxTgo1@SF`a=)FpM)II1;i*=bO3|| z@u8(+IaJ2D)xI;`GQ|jbk8$cqnt5fiKjjR@Od?Zh-*X7B4oqvPXLq}8g%>__!EbrE zkyww8PRDDg5lkK2o-Vl!*ueHE>AyuE199;p2z{>|`2 zUw8^7n`oQb*Ri3HgcZR~f=|uDS)S9zyoNEFE3p0bzz7CMhPoH}@Sn!)Tsx38&ZbYD z~zUCsMn8-z3Cbcu`Q7C{X`;=tJ0S{P630W5J;-suf~cW9V}wUlKKcO`h1~ z=>E~DppQ$RqgsMOQPhCj^&UnvvxCQauFQxTvvemJKs5(;U62{^JVumM4B3jf&{Af` z@AAwQSk7SnzUK7Sxt|T+!*vIY)8GF`em@+X(+oZ?0HV!Z3i_i)UQMYN90V zr73ce8f=&J=YxH|UHSfMm^wu(VPzmUPy%8H0Fuz@6{Rm>4(okkp-KiB?2DJ=} zKE1QaAU$Bi6AkS-`kjLKD?cbZB89VXs8e4R2VG8gg;y-td;p{GMS&9bb>g4Rg~a4z?QoGDR1d^shYt}f z|MPBAxhX6*F3NqvS1i&)FlKIC>Fp4KUpfT=GMh&4@(}CaoB~|a%nrW?nwaM2sBCKv z&qF8$CQgN9ZZl^@mZTl!+Kz;71W2BV?!Zjh7wGrX-#>B1Ftd%oQvMGm_5E^d-j04( zKGE&U#S-mM;tV)bDlKm;AXa|oY|YhUcao!FmCLE=MKb}=!wEWo7y-=Cp_d%ahVQ!^ zkY}N%@@u0bIu~U|8s$22_z&0c^kts*nCm-f0VNfX_!Bul-zCtn8xS{ImF61%WM8w( z;G?W;?X?2V-!2tc_OD#`_P#`COV&Z$czUCdvpBCG=XH`nbY2={_A+B z%?Ljm&}P&U{k0BF!Ah+xkq%xXn%QYxJ=TpgX*6+>SdlLX_nWFZ3DuF{Ez5N1cW}rQ zP~&7jvKV4{cuycqzU;0USv!2$pt8u967`=6geA*5c|A@x55$rz)Ot5z?+!wD zj8}b>^*C78Mo&i3yXc`+2Ej3-QXlx<>~!ZE9)DhJ*4?cBz$9gp1$&Zv|B3JlDv|DR_&Ss{tsd8t%5~@Rm33M{UEl=SwAPY8=j)d`iFO*BJ}hV*{pL{=d|#dI zxA2CmWA39JdZJRfYB}3{xp|t|4M=N%pN4ozvc???v=d=EFJA<(+}6nO+rmxbA}PbN|gR-{Ct)8BV7*Gs~C~AaIIKHN0W%W~}Q3^c-do4a6yL+;o zN@JF@)PLxcLfycV)Uy38GVG9%u{ZV&|91Mk)ptii5B5hIyYkaCBS?D~{=dh>Romxx z`lyiC%XKZaa05Ve%=P_C^)g@cG*Oo;Eqx4!gm=fFbg2g+gY6mba% z;`TH-RMJC8QYA=CqkqvC@E6Py~ zjck&4zZl^h-CWz-3hx`oBK-sj1I+#~e-tmy%#QFETqq@7GuMFG+AKpKd?e}c6{x-+ z5gS5mbBZD{iN`pWr8eYn%}Fu1y>Syze|$(9IV4@~E(v?9HYXm(sc6K> zRli1C^;M$fD=f{XKi<>!Ya4vj9OD(refX%7R7Be8NWuD@$vb6*>OXPMj(u+PLr>MS zdiA&1LMUo!%hvjNw$(56b(X(6GPst)s#QYuUne=a+Z~bZn$vd^CV5|kPIG?Mbd1*? z)Bl*j0czPwmm|X<qBH+v3p z5xL19s0DP)T=U!jw{wD-59FTeyEf4_>ir+l!72Ch?BQAlWAMI~bS&EW6k>ENmhw{I z$4~R;&{6#Td=2%U_{`(t_E zIcfC$8eii;)LtM~Tzzti0Etc8f{Q%kl5gDsw6c|+jmmQ z=beifL{TOZ`8fTsQZcO3rZ0%o>5}Vhji_nAQaOTD6|kVE!1IwYT@{vLL7p0=6dULC z#9HfD7bwitvd@gTHSH~hs_l0J*zZF_vSuV**CCH?Yx^Ui>}l4q8_r0w?`qePHLuXy zXH0x!Ji`|s-WLw@n`bEDg`Jmzn~cW-kHNr*+-8{{li$Fi2E{{7g^2!DlUW*J7mF~G zojc|>k7a|iNDj%wBca)!?WqUF|Bk)lEBX6nK-GeEr>V6u^+E^Gct7aPyujb!M9n#M z%qti*JEf&mlz+34%t2{GWlRRsugI&EFQWHiKQ8p6)-nIr9#J8$Q8PKRwQ{k_kv&7w z)-u$T0hWHIyPhM8JFJ7{ zMi%SXtWRZrx{cg3UcbU5TD?=oR8#4jXGCYECsW5N!^R~WH^-)-f_SoMBAdtdW)sHD z@N;?o0_O~`8b^)ppo{`Kz-GW#V}(8*GE$Mdg?>EXhg+Z81H{bc6PYn?augs1GMnM3 zM@>V7)omlBmQlg=gkSw?%N6dF%aG7b@V={Dxu<1oCWBbPH?sS@(_e1RF~2oaa?t2R zAn0;Z{48l<*Ab%He>e~QuHlSmPf0PqJ39T0I%)RL4eJS)GZyuwv+`@{!ZhM^vM#M6 zLw_OmL5Xc9@t{;j=zQ+fV3A>8pTGSP4EMixku<{KUbf$+r^jdJ6Dia>_h_{U2|u4K z81c8+=W_+XiQm`#9_vbRRxJ77VqH2umZf^;hv=}}<{InJhg#P+*o=86{_cbVrJoeI z>DJk>2X_ZPKu)@TKXiV9Z#2N-Ovaw+14&PrW_^<>TixOKoU_-Z%=%NT%GGj!IkFgl zC~Qolz}0eYdVXfq)UBO%(B7_q&-q1#n{?mS4U0%s$OeqFpL@yByw!N_yn=bXDQLB_ zK~3P1S&_BWh7=SztK8i5ryH^Yz&$)b+9&#pG@NNUMM*kX#bEHfeM9AGB*Hx4vN0F0 zDK6>4-s8j7D>th~+S_%>GrHwzW-Rpb)2)jU^_xQ%T<8=amSr$ohwg?&v(=*)8dC6vi1sqr%nb0LTNxLp4Yx4=~1BkhJS&6MV=L^L>x z2mjP*ma#u+25_|^ zrNg+cg!3o7Y9`f2vs5-_x%`r|H#D7K5jwgI{amXV6y7i$-NS3cgY+=qX~J1W6UDb% zns`Q`GtlWu&p+C-(d>9I+9uiI;7gk9;M$eVWTjaH2UDFZH-4@cdSZW7p<8O^`cx#f zPIUkEXDZ%GLnZ!^Uk?5KFLsI?E{;u>lrX-QmY|5$E1Zcp_#*HQ9^MS0YjLXh-xy9m zhCeN_6gzse`kS9Q<#(hXw)3^q;g_56;s|SRuGL!-`v?}YtxZjDXp9Y?j~=lypC^Ch z!<|FKi?W1PzVE;iDCD#*4CxNs8xDmH(aG3w)keA8xuYV&Ek{&UP@mVbib~Sn%uDNK ztrcLeR4ztIoQ!#DryDj*Ds(5gQ zYyADK{4yT8)eQ4SXgsI=X7}3+4AemG#&4UhpEzq6dKMzSo>HthRxzB9IbpcEyKJyF zLmw6?aI^%Ow=Kro+uMN8x5+8Q-FTVyovfJ3PJGytI6eouc?etE+J2XMBBGuE^fzAF z^7x62|2x8>`kiv$WufRNI`FTdcI3NJS9i0Bq0&(?N3UY7OLHo8XDM2W})x)5i z7-&|RH{d9c=+r+ctTKJp?#v1tj)b$imPtg4CX^+)_)PxY*Y#4pNDQ+{PdK(m925ow zYZmS@8}0Iarhm zAd0p}nbAQDGIHRYx{g0{=xcOQ;8UkuoJSlh8ddHT{>1(U<*C8tk<(&mRf>Ww<_)l` zwdy?CN&GDAfS5xZ(>V@|Mf^Ubm>KnHLW9Pqr{o8EKB}}F_l1-r-Rk?Fb!=I{iR5`^fvSP+PQEJJIeiq>!F#+rZK_}i!2;T(3S#sbw&9w zSe{{SSzy!Pnwvw2+j~>+RcB*^A42lWZyhzfFReY4?Kj)NDT?6evvv&A%De~98S=@5 zr%X{-?9CA%fBS-2bgzAQN+Ky&PgU)tn#Ffl3=i)MQ?hF~i2NP(#C9pbb!@U)sU#gF zpFhq*esRdxR;afdx+MNAl+ij(wY*Ln38^=RjA)M7lf8(IwGx{f=k>(*y>*CaJ$s7f z8ky<=VE6rPSVtoh2eYmYbg1;$IPF7pS8UwzU0P(E2ppSO@1T;pwnB(LUJ!gMNqge4 zokci)->A+#HojcP>tiIF&^4C*KYos9~0xBcTVDxyz(XSX1-Mfsnx2*Fm?$*!M!HsiPULW{&}u zm>0X%;TuuLW}H^rwqs8kdAG8tQu2AeGCJx|Ky?J~3ilbW&av=apjcnAXtc~dPa1vm z4K8PI1y}c5K86|LL`{C%l%_grms3J(T1IPqC2g8Wsb^1h*7@l2Cr?%Dd}Rt)goWO< zlsE7(=sA`eCrzJ^i&90ZK}P|cb6Ze#%<#EEi4t1a+KsK>*joV2UM~4%hdu}_QpJWq zSvUv^Q|gspX6%+9m8`$%;;t)&hCO`a-;g+7+WFUJ&A?B$ez>b@|0Q&#^`v;zDaUm0 zdjd8fT3&+0$lJnLzR&T7s+s_ALEdsCkwHN+?tVFyVokKn@JXgMWnf%7d1%Mu!Y3-? zf0;-h;4Q5FI^1Re+Z7!xxbtN09ez>W7w1x`j(fH>&TC0xx1sE5edz?P(vf%m0CaGQ zo3Wi5`A%RI`Nq#tvF8T)$dQekq=B=tJRdh@JSZx*=&KPjo&jMe4g33vf>i! zw-X!<%9|3fK8s50UOQ&ODo9a%vN*LFg=0vQF|;BJfIV|t)QBxEUv7+%%neR1hDl2Z zEWw<5ihL7w@ViuB5ff5_g}W%g*aJI|+M@MTA`C+A64S%AfacG?q1er zzA0$B8CwAgt(r42Fr+58WUwrIwf@Qg@fiusJ=X3c#t!G(ubrGo$s`{BB`*0hT)HUt zl!MCGoKUj(q2yHX;61!4nU!d|cE~pGmvebG- zajfvd5)aRuOoJ8VZ`j#8PCou#)=R%jC0nMjq#@}0^DWyrdR7IOYKSITS)YJ&HO{(z zYzDAjCL7?HmSgU2qymxo?$|&2seqfiZM0>^_}BCF{_Td;YzDLa$q07TQ8^TBWqK81 zz;&DA$bsm?oHn={KB6=0w^jOg9Ey-@slVha+-F6cNp05SNtX0LB6tx=USclt^}M+_ zK%L@ol$r9gRL2Y<#`{Kk*w?9_Fh;;Gg1i4H8Trz1y$j{I38u%6-FrV89K25U9l3dtn z{k}dm?lfZ=252ueI#;?fB5sn&tiTUr)y|QEmQ-em8FP z9SVz21fBN0w+Hd?zETEJb6fQF0P0G_$VI1%?KM1KE&IN$LToATwI{?%ZLu_3b8dC; zUAvcTb;!ClFWW3MlmxV@X}xY}^y)9rjCAxwc4#_im-DB&S-r(ThqCH6XY>=kG}@K3 z5KqssWvAHy13X%Tx$Z5P*ae3*w)TBX8r8`X zr^&}m1f-?q5ITKrs!Dh5a)cut;ZzOkmvJGox0>C`zVYotMB~w_C|{DZvha1h(&s#7Mb z?rF(lx1aWc=StE}Rc>?UXYSqIgO4W&-w@beoWjY6kE#dx9K-}?B-h2e;QM$}qM7+M z;!jEr&Wn7{r=$#H>)jjojcb+OwO$@;!Ed3SIX$2t)4sHC;bmHBt1syl+P?XwAiP4T zl4U^7+ejW{>e~P>!XI~AYz~8ARS$cw&`oK?oIkzf1;PE9VcZURhyIei*-FqMOC=g6 zrZd;+go*xmo^P{)Ss)arGHu!sL=vI{o!e`4)GUX?+h+DAS6KX&&j5`vgV+!1>bE6S z19TBsue`h0llVsg(;UDwi{+}|g6{!euUCaciYzVEHR72mR?Rv~~DkLpgnS-jFR z)u<1)FmC{ZQu3H*||=7AKvF!*ar|ZPm_O4uO6>>@jUdHiLVk%d|F3rx11Q zq1a#q9pageOS_y>vuWbtLn9NL43fZ2JZ_VfFNr-;lkp{fnfqn|j6>dIRT<<9^(O4! zj5h!(2ngvpK}uqQ-|pMuV))H5+KBChClfZ}SHN8#CmUT1Io2?qhA%TYVAgpy`Yot3 zU0S+q)@zM2liO0(`h>AMoF{o%<{GE(h2x1_U_P6`NxXEN_-H4KTa;-tJ#1$UMGcpn zTwCsHA5^C(K5Fpik^It3=Pqn**$$p*!P(N<(Bd&NtLx$0cxPRRdicO8v*mEiyIH$u z_vYD#A-63}TmN5Op(_Id`A^P|^~~+77-YY?GJD~NGA7ShrwEr)g#nzQt+za-U-oeK zH_P6#s|7{2TAcn?shELkhel{jZkkGB%I6lPX-7YvmA5F|iG0N~;Vie&Y+73g21&Dh z7ab373N$I3G$U|pUa7&EmOI3qFIN1ez3KQ4DM}WGP8i&3A(2gtW#C5zu-lyu+){!? zrqrH`9U2FVUcJEFJ_iJcn3NJ^l1q9`3C=mw%@@kVVvYO>BkJyZ-7(ZSGSsi`@Rw|q zLjjV&ZKo)GrT^_x+S3 zJ>Bac3F_M7%}{SbO;FZ3GHF?5qPd`6O$u5fk(g7bQ45D zYa%gq4bkvE7)V#LJ@zFZR*WpS5i;M1@yOXWWb1sHKzof!EIY*6@;HyHI5rmz5=YTM z`zcPR97a=kA*LN*)%vKb9OUx z443P&HV7G8OluDE);%A4(euR2!FPE)&lrt5!@J$jF3cA$9>=tJK6&FK76-vhSNhKE zOYJ6!sWb->SDu#9h-W-Dnj4hthB4B{eLVh^Bg+k`pDF@X3Vu9mo8s+{uR)&_t+L|% z&LjyKIzB6^D_;3>etKbRCRrBLM&a}|?B}<(0kE%Mz1OxaKHgV@_DGqF@|xq|94gaJ z%^i=mIoSGNI6`K_313Q{BF#8O>vawy9zp?cGRvU#s$fdinW%8r5zri0pE(D46AIC@ znEbx{Td)x&pXzp18}o83@}-u_@$;+ZvuL-dE-AQ2=kt7V6O#@1oap?lj__DqpjNp?xH(o;TCvK+!ac$K zbbPVWaR6@Y4=rDSW(u-kD3t^+Wu>*w^&RnJ`&Cn71@V;+a2~Az2f8K@&`AV zLZ;SfS2a<_n}F^)^VZF0bkAL;Pi^K+p5Rq^bbKCKklDGya|?T7&!SPtlg5?Y8tdAw z(1s$w!~5VdK}5L{)}D5hQ*YKGWNSq!m>xR*JPtezdptDD$__J$1YNvo5~$u0)TDs2 z%6P}vN@2vIJ2v6_juYpIxDy#~?}kEuTLg!bqjF!mL;*uiqOYr8L0&5jw`@14J+ud8BrNFz>s*kngb!^e`S36JBJ_3(gZyCnQ)$w(8+#(>|>zAg9$ok8;}+58lY9JdPi|B@7}+1@wrxb zJwa}mp}`R6mjs8V$oHAy(^4VkUW;BiMA&MYD)s}tO-l2=gG0lV)7RqEQEL(>z5bOF z-+{ia30j*a;dz)Q`bu5?xJ3`@?qFWX$qB(_&RsQ|0D15G(p7KNB7hZ-u z*PH4WINP~nHMt~9IZ@K-o0QGphy_V&VO~|X(8G&y0-P-qu=PLGq)_t5!b-Hnck_F- zRRW)bB-Z=pUs{X~%z9=ue*`oP;V(QgI3@DitgUi{mrTSSXm?`CNqKeWGoK@@soj&K zwaEmq#RWrb&+N7xN3v**-D;%N0StyED$O(QffTs!Aa7Ynutt-BM`8o->=UwSUQ^+l zQ6W|>_zmh2O`m@T%K!MN_E56XLEPR*ve~a9PcdyhbxlL7FeFXk0p*ESPb=?4qoTSaiBNTmT+}Hf9hO4z`$z~|Y+=RX~ z+gC-UBRKX!m(qA52x%!XtTgYvitKST?Y$}Mn7wdf7YPfy>G${Ly>`X>$}XR#Xx`(z z*l<6#2Xg-UvhsY+9}f@DgWc^VawzH*{u%nE(bF4e@$_j=z2Z=7Dg*OQeHyK$*1dDc z8z+W`H!wSi@tWei2j9GA4h%fDgvhD2)WKPTaX?Ws>$(1^Au{JQuTJP}R14>l6-vLH zQtiY=XL?7sT)5*txOqIarT?6h2%$Dx4dpe+8?;(}XeehKS1RKYl0i@_3`BTs8o2Aq zcjF8zWT=z0nuvBVy*1CfS|$M@Q%XOwN&(^q5nim4>#uA|fmiZ(GoGd*61_Rlz_ut0 zPpCiDU9`rQz`_1K>V{lu4W!Vk<%m#nsdp;_-Dg*=C*5>0we_!AQ&wh7UH5OIp?C0L z=+t~40g5S)H?^L|MV%E|C!7fhzLPX^p_ToR)}6rUDtvy zSl0Zu)%qYm@i%XMHWS?3bGg!FOuEmZzt)?Ec3i(RZow3Iw zXK?Sh;UlR;sq@bD`&9MF@7o{l3In<>8dd%#{pPsurpRKi*mlyiqrX4s;s0gAzBVlcTgmi36`A6D2`Q=Y zsp+pTD8XSFLMdDe4DgAMa&U29LP3h0kL5c)7^OF&etK5r*7NM_Fv`%eGTWqhb5b_C z#H7X2zPPnQ&xFU5`ZGdX&L*BP`3C4l5^fwq1n-|} z9RXAn7RXugSkgKj*Xa(5#D`2th;%5~c6}J;wfya_Q_m}CZ(TvGQR1Gx$W$Zb1Q()l z$3lf57*(i5zaECb-7mYT2GvIk*5w0;RSDhBR8Qpe9949`q}pI z#rD#SPB4ojFsh_%Spr2mO=u*ln5lKRt%&aEa+>`6D$90*d)jk3#O&cK< z{(}tWZ9oI|!$P|&Ds}A*J{6vfGn&^{J^pT{n68c<5aHwE2U`NOYc--Wii$-WP~O~l zx{2)~{ z^w_Qqlvd*NHdgIim}823T2MGqiGSsS%7c$25dc#uShRlV!Lyin?8sM_44&@`v;mK) z$wgi7v(2H$_8f~Ir}tq2vVCjEFSd?V8*>!-v;g_@>?yNBKYu9t7`$ev!vJ6acvA3Q zbo7)(cX&|$be;18DGbKTVqX;gj0 z!gQ5DZ&V}(WBNxOaC{Cr1kXjkMX1_C7x?S{F;-zes%xqaNNHedJ7Nm>bG8c~_a;Z{qcah`?&gM-vIrLXh2p%jHx zCCt4fdvhu=4P(kXjE-;+YUIikKIlGXQ=DJa*k@b?_E+ayY~*?=dhvp$$zAC6cu&2# z8+EPOl^bU)K+p-MybA!wh43fBMe^O(-=g@AAHVIqXHV_vyMFJE*qxUO{@R@qG_E3J_OiWG&DmNz z5a6qEf>bsp#7frfKJ-7_5ApDRm+!HE^V6=Mp*fxQh_L>;OMH&e8M)c^&iaQ!0)cz{ zmFe5>qQste+PfJOemeQm6(tDtE&#K}wPv_wH_Uk2uQ-M_iW^R3Pvgf{((2`MMYKBn z7|Fx{^}=t%@3e8dmCSk~=L<(N51m!?FY+Mi=>j1{9d0yr%^!QYG8MAD1A2mDkel?G zlc_yW>)QP^t~7am2|tkEGEW@(VYPnqZoCHY1m%9ZtKv(W5!Dy<5p_#KOv=$6Ud_z! z0==FHYAI2h-1j1MeW2iGnl)+9grUWFIpu4^#@#R!&s^+*t$&;|UTse4r(PG(Tz2-L z3|=KqMq=<)_;I+(R6h$GZ!MCGukl^$ zO7Y{HB)+WLrM%V3o@q=SSGBp=mz%I)?)3|`r?21e+$xe^ZX)4~hsfu;eFgXR0>Ylh)G#Crbk44V9V-T*euISu06rNS^t3)o5dUJtLFtW) zhN-!{Rn#{o`6eQxbE}r^97j|U%AGE@ZSUj@r>Fp!TeVNqz9eLNGTY3Gr1Z+aQHN8s zXgZ=OTEG`cQel<^oF%D(zmNqEh0Gd0WBUyP8y9V2|TzNkp}4|B;>WS!64JZ&u#ADAH$x4X2T8$O>i z`S(S(<0ty`yty3onZd?8Ius477z}ALlj5%FJBHul;_#ZIR;?^QlyR+&vq?PG!}RHX zrn0IOU(B4;jC#rJkvuVEuCUVIH(@I`R&$10Xw1GhGg+ZiR2b^!HeIrvyG0D1HdU%+ zUv9Uy=s#A~A?T!t!~%&SS8n}wEs+GlDY-VYb#GVE!OfW4>cYr2hQf!A8+llt`K3@k z@O}zFFg+q)8xqb`bH-#_VuijWDg9IkB$x#Ep5JVEX!X@Q`X>+`OA#Nv*4Y-mrrrIG zP@-sxbbB5vUK1-==CNRad3Jo2y3krQA|4m^s5M68LKrwE(Ovf7)>f*1ME=En_HOF{ z+kf6fe8oNYgYTN%e)z1gGzB>^n*GyE;|KAdEnvOh;*_@uD{C2la8a{Ts3#V9%4h(4 zom++##Oj1%6FBa@wxb+v_NCJHQFCaY3i-zQ!h5F2oI_N$(-ARxG|BvP#XV8&FN{tO zBepeGgdD0b6J~)=MoixUg_z`lr52>h{k$)8Y0P)?4hSf@ex=X;o^U?j>Q zExnEzKQJ1?#mEar)7|gQT~5BG-Pr>lA~TecfOLD%>{~0NgSyEm8b4<9c}%OtlUq~x zeaP(29&00>klduO+ag5_cokIYa&Z}*pITw|wCT76nzAF} zM)OQt*5BQ3nC3)AYdyH5h@|)7<5*nU`1#OAy@cK(pa@9`{H?yoy3fMLJ2NNw*pOdaHfH#uKT;>0mo%nb7rCqega`4d3R)E5j-cufsr^r-oVTnCMkcF_oCWeF-UJ?VA^0riiZJ=Kl$I{LxA2!j3 z&&9tSQ~&Mgf1C=Y22X{Q=5H1^NS2IumD4RtXrr2Sid~t2FsdqNKQ1V4D< z%WQOw1yA+t@2Zg7So*v!c=T%Sw zhxfbx7meRmLRJ7z3do$1KS9aFWrpGg_U!ix<%{HZp8iSU%3u!#^PvrE`)lPG-{jI_n(1Mdz zk_O|)!P(E;bl5*Mp)4|3KQsaEG^vxmWtzG!1a(<-4@Bq3j|)YHZFEGUaD4(`Rr@Kq zi3+PE`O%7blazu8r9s{U-Uy*t)I*D`I6k-Yh@S;z~2j)Usc8yCsOQx9^3cir{I?i-{p2`qO5Urjf9OYe!-|X1%%!J*0#_ zZo8utxSQ$Cv!glDT-;d0P9{f&lK~-k`4_97Q}qv`pqN-*coHV|y&32mw%HgN4sgmxiZ`ULi&-3I0GwMJLOtC*eg^hJ!l-;3>y0JXQh`uoE_LmmybxsRS z-0t~WkMDmn`sUJHY7V&%x3uI1|Hkq~?y%<*VQ(nc5w~9MZgc>OI1e7!(}u4us@(H! z_XDY3!6JGj(V4hcMzKOyiL2RSq94WkWKtp3UCg;_u8e-Nc$A&ih=lGfDxz&}QG*~? ziA|~YV=u4hj_Ozu7%b9D_*>WsuV6>5DIfdgwX29%KZOkQRc@IRx|&1DKCpS@=8)??{DRTP$pmuHLIvekt{d^aNKOI0Q6WQ<*BWiUFEZfRz;t8XmFjh=m}ejq1jVDigKdg{^!6OkuY;A;j%#)7+H~CyV+HA1l_|7Ed}g7H9(*2)%v&`Y^q}}uJRHmALAB! zHm-Kyj=>huibB+%*wuG;1O-n~W1EycVOz8yQ;UdB?cNl#`XTu_C% zJ-VGbbqAbTrT_W67#16L?76J(uMl%> zX36)r_3A$2V*#HmhN0=B6$Hyo5H_AXI;L1lnX(Y^{#A_hR$qr@+py8we**oc)3ojR zo%O9U7!RL`@+cdJt?ofx(+n61UfKwr^4jj+{^ug-@peXWy>A&Xvm^G!Gl{y7FI|xe zz0ECee&&p;k|o(E6aE=T!7$O*wvK5C<3D0uYE!lYg2Q=o_=JZeCB?vd6~fv$>_AmZ zh_shgTKUcu9~bn3JECe{gsYlKyntG6Ecxr_u5a_k<%7~uClveQ2c$0viuoQ+2E*qn zU5&U__K!`MD`kF$l=90Ug(FwC?v;L077V=!32#{0zN>$4JO3B}4cN4~l9e?7f84!QRGdN6E=q(XK!5}Y1a}DTZowUbySw|~ zkOX&k3+^(wOK{gg2X}Y3^OEo1-(F{(wa(qX*?loHYuc;3tE-->?#{TqehdZ}<{zKg z&}^9nnKb~S!_fZ7tsYe05({$2vV$IcRmB3U^Gqn16b(5YSH`Cq7z-zv=%=9nQZp6L zw4399&@6gV3r=CnA)*7&+&r03ho*Q97T+B2v|G61B!8Z z%JdP_fUqv=DEYM6T9%v-GfP1&KbUHx$_*m>BnHhME*o+JHM{na1dN7p6ds)D)$vmn zrh_~e&ve-;g^U*zgvP3Y76Xu3MB)d|2WLnf!slGAQkiAig061S(%v{9`9MiISOWt0eCuVe*o7osGi%eqoEA)re>yCmtBj&*Vo zi%rA0J>%~}($8}Q;|!jMBWMM&zO9Zn!Q_4vo11dc2_MkHQmOR> zgW~l>FBgoezS_NVeQyPSH?Is+5@kzku-ZVG8DZX~mwm>`hs|yhi>2|af z(JHdswxamtLW55_j>jUU5PrjK9Nj~8-m>~TogUqduirjf&hmGF8t476oI{3WxSc57 znjUyJrO-<=}FhJ*uUR@n zfqtJuC9u)BS^gxC7xx-$qSpiP3?N*kQr^`p1&|oHN-Axc>+QO@Zd#|{>j5^uQ;6bL~C1&E==algK(T|qTB0un@uiO|L z)CE(Mndhx+?{(WEQJ<>JZ^Doe!@FBi{=#j`?=Ei(^k8(rRkfbu7k5N_#e!+y?;tC` zYN3I-&Ly>Yb~e~(l^2$if%ACV#l07KEN;+xS>CF*Ea7$)^b?Z_jDSiDE*M@KzoDr# zK@;0{%U6J#5?()Y8wMr?Y!gx%`%L7<)XkX`t67-_<8{x99ZH!ryeJJU+tJ)iBL~ic z6V0wVf~nh8&ga(#Za-xd&P7eoEceUkAfZ}cZ#h*@w=ZLb=nX{QfNl!v@7|#P7J5k8 zmqPAsC_Go@6HU<39Qy<|0j`)~i58432iENh>>n+Auk3u;ZAe9lKVR{?<#omP?L?iw z==~pCLaBL+84*ngo<&zV$Cd-4gqKr*vy6^AUCR^IOZT|Tz9-T2R%gaUlyu<%%^nPV-1ix(Qwt>XZOu*Th0F4^cxshYznBMSVPtRO zo-;u+T1<~VISw7i-C6gwIa)SLK`Or#v1RJ zn18+}MkZ;PdI)g19m*(ZVSPZzQTC*`U{5Mu^rx(*Rm796LmL$SS}y*Dlaw}fHmPpo2O})6arE$jz>5}G~Bp)O3ucx znKy#P{G<-1h9~LxBK#k+8^{dG&5^zB&+ZqD26Z!xzm1%Gg(tX@_l|r!aC&5ezU=rX z=BMOhozMHSNgm1-tleCZ3cTLR56GT21VAMBo1zY9VRep6lh5m8(Yl$u@|FuH0+GnK z%SBdPsWk6B?`KJbNiwV?xIqo?mcHfd*E{JnJ*<{};fZn_sq4wJxPSCC&}>Z`sAaE< zsl?@3pmDy)cCW>5bTl#O^)nl+7q@p7`NR5(m_pS(SyT@{51S0row`*10rgAKuY^2? zg0~Sl%$Ec@Gp%=qJ=P{csXJXl>n*K}XHE;DR*$pfY5YVV0N57hWFQLlz{0x-RACy= z=W{2xjQs)TkvK+2y%W`u62?>k(QB&>r^m>PQ!W_oys5PgX{Cd{_An{A&Zjl)?T{oS zrrhEFqDDMMY+}=>cv)xr4R+b0?B!o@*i1-LeqY=n8%h*In!Ay^dI3^1PuK<+){07~ zuImtKaY4w$#MpAUsVv2w6P1-HX|^K>_v38qZ}oI6E?OzHD{hd}$6J!q8KPwHvK_;= z$0L(s8sFrJ0eQdMWN&t+qBmjmjTBam$NO6>pc}df_WIoC2~$qr7FzQSUpnEr7NDE` zS7(wTl0o;uST&;7i{=*aagCZ4bDm13x{jU)^n2WPpU-D^8{2lYYIXP5h}Et-H%g6i z$jUUO_dV}f!7{M*J-Us6;_1k3)O#1 z1O?)gVsW!85R@87`Erh?8v3xg;`3e=D9cyv+a?Y+Z;{b%Ra$6gFD{%;)*@m9ErtOJ z$>xr9g_-qa#_Z7UxW9SzhmE9k$AS-(LY!5{}wM&e_4+duBhZuZDZhx8)}I!W$9FMri7_sNDyK5)NtZX@?vXUo^_!!6e5 zrpb2Gl!T_ezEpk#5-dFWKrgrMn1&e5$Ng40e=7pD%HK=^OWc)$Or|SjLNcn{N8Fu) zsFoyHh=uEIP-0nlp=kc-m+`AK{$ZqFvkcqKpIy@3xX5nrNK|SUj1Q8MW?U?eGWh^E z0+{wU1lual+3>C5pF%mJJsK|6<~|u=uP7-XwqE*_+wK2GdKUgn);2x(P;fl__GioY z)B+jf4ow;hccc4Ctkg@OYY~Ap^GgFD_wDybwP(6Ic6o)lAF7Unu5U~?g;$8-P7~|% z>T$CKK$YffD5Y9ViaBO=)&+CQU!57K+>?u;%1~bQJ1e|Fm0{Jq#a=89lqOEvsR~?9 zZgeaXqTiqj?R&5A?Qu_BbBNm$w}Z1iRwH zzRaSP-6$roL5&0bYgm`VuCJqD)ET3MdLASdHg_H8Wo!f(_g{Q|UpZ^I;_bCh_b(4y z>kw90vhIow6)=&Y{5!mtGFyWEbLqjF+zbNFkqP87N=L$F_BK)VVcfiSB6%`)M7fH# zYJ;!Gl>w4*(&}MQ@CR^XOQ$p!zFL14@$j^vhB-jULU@FVeP2Fw4}sC9DC)>7 zIP`C&iQg&=!JHT6U#86l;bw`+`*fqpFw(Hl7=C8i6P%%OyziFhlR(6SgClfey!xvH z{j7MD=x;SsHRTcg*JcU(G%0`}>Jy>9O>bE^tJnq<`oa84i3+}Hv3_#ogCiIC^M52} zm@6E)S~l!jx!PB{ZyGq?!nAy*Yb%oO8&R$A?!kFom!B-f2-3DfnsIzc5 zy_455Gl>`b1YX|b@#BX7$FP8*^8@TcvCPr>J|%}maukT`v_EPAT3tmJ9TDFKNk9uz z;s0VR-9Ct%@#GO^2r+?M;9D-Fv6-H)1c)m!<_qlf?pX7t_T?A2Xq8%#z_UH`hi^nk zL>7#LW`nU^<1J=b#c~!Wz>`0Deo$})&EjWkz0B+vO*_YD_W0W z)a}2jOF$8pH%;x+2H=*ZfgIP35@)24?801YPxpY&YwWOfOxEpD#vw%t*z4r!oNHf2|8P?^p;rQz`Y zSqCS53sNRfY~|=wC@yqHg$(|_5>f!hB|L*`{Rh;*z|_BC9D2}Vd5HT+9X1`$yT^LqSS0S=afaoeAYO&k^)8>il*i{9QwrKTl$O5WLSi)1!3iAFU3F*!5{;tB~z#^^(J-&XJg-sWLyY@wCDCZ*}d(d05SK z@K?=P2@sb|$|HejwqWxcK=r7QE$WcJlA5QHu{<0EnC5?TyliGq+7n^}>XS0)M&ot& zOYOX$aqpX#u=lYvReWsjmuUZ+_NR(83;Wfk@PV)-^a^tQ?n<2HMq*7gb;FXY+#dN^ z6|wC9ojS}>*fA}+R(ADk!%GW@Wl6B&Djaw$lB1s(cVbU>gAV>zBxQQ0X@OX zH#aw(qN}YD0iCL>zPXWsBRrjglfL7>f5ffyOpM^^RLl$=O$it{Sm@#D#Ei^LOdSbW zIN0Io1Z^yB>=kVF41ml+Mj$f-BT;)jS9m%BGe?IXM)ra>R<<_QM%Io5Kw1$qOGhJn z0y+^(Jx3!UBLf>lpkOH@Ym=9f>6w^VSb2E~{-=R1sRwDW-xaj5e|pCr9mz1X9~~Xt z9UT2_M?Zjh^F@gI(`TU{XyET3-^zV96E@3f!hUubS?u}w3R|}=V!7O4r)9wll+m)? zeA@Qn;rD+qd>>pjkJNeWd#PdtKUKMr>6fEZ`3<&UW2nZp8f%;uLf%1WYe~#f0 z^d!$GKMqsx=sf=0nN~*g<5R%N;H0RS?ru^NlF#xiVkjgeUESSLMZ({N75t6SfqF&$ z)oapuV5}`MOq8WRVQkaNCR9*t$fk!Kt*X{~J^4*a<^5v_QmS=IPhoB^Clg@Jka zOdnjJJ~JE`-BCI5%>(`Qzm~y}(>EnyG^xF9QY-ud4ZY-6MDiPT};&?X`*9 zc~n#Bp>Y?9Qi(|v7SHqE_CHqGMtm7k&_$YKw9r(Yb1UY)6J&BagF)}@uv~QXT4rmb7 zOU*EC7}OyJ8|qboMR>5DHITmPDgr*bx1%pnKN9A#M=pe{j`4SleZ{$GlwjxQK?}9I z|LJ3v@`_Z35F{TGQm}Vcl#QpoQ1(*l{!31nHbjGwoq;|Hk52$2CD?fB!(u;qASc@^+LlI!oZe(Cj{+@1NnW;QiG&of3-Rh>H^T zG5cV~t(o=H6HmSOwTv6qfW5r_-`CCm={LbtR8?sFf^6*hb>y!W&V7r*wPt$N`F{j?x?7Fs#|ZA3BnLhE|v( zfH2I7_jFcNW9CKeBQK=;ejqhn(@kQu5eMAQXUOFqialMfA*$shj0yL-;$IoMiPJT? zn{g1Q60gcM8`(ds>2Zdn;_6>#F<SA;JQ?V|-+k%J|g2;d#uVC7;n00VR!;gj8S# z4VS~|hv30Nv;FGHN%^>#Pa9^nS+1h#-gs9mXOE99hbiv=go2w_wsui|R(f_69HdTZ zNLok_hFtjRjK;Rdw1;+lC=7b62SeTDg-b>|)uh;A&WDQz&DP_wnOYFi+hoX-;&pp~ z{2ssIB5wa;D)CFJ+L2!^BqiYcjZDB(svmxAEPw6?@iHQkTh+}d=SmbMS2$o3=9Zz( z;M90ua1yXnb93K3Qbp|dPKO?6QP0P(n=IX$>kW6haQ~SrCwM8anz0&a9)q}=Fb?N6 z-reLOcl;iD-uExuY{uKQL|AXo@tZC=Da(UTkEzbHJaHnZF|&w!GBcbki<9sJa-{~f z#a>D=W!V7%Z+s`ar8Qn-V?8QTnbup)EPJSt24C@C79W5$S?gwOo?SRF0!zW{R>v$PMm&>^`tv02yDsc7p zc{ytEu6Y^Rm^B9Zjrs@#1F)rOP7;~(g+CDUc{`H76jNk7e)}rGPSm?^ypD5R9EZvy9kL~fGR7%9!VdR1i8KJkL& z;|pi6S%O9OakCM9GXCtcLLdI>Pn=O=sW;+sUgNOqKMd6v@j?5fJd7qspaU@_MDW<0 z@Nk(9o>BqDCso(gx5i}CJUwsHls(h{uKIJn+8SoyZ?e_C{Bq7P2X8SkQ$}WCr$f!= zCh8|N6m*pDC+FEIz`}mm@rP-HX~kIls{;p@?cT3L$ObDcWLsHV>(wih=6-?6Y`#_^ zTx{U|Cv^XFL!_~Z6RDc`XMSG1X%M<;-CvrT)$AWsP*Qvu*>S`2szB)BL}PD#dH>V% zKmO!iQDOIHmHfSX%;j)@*s7jCRKY+ld_>;CW4^;xl|Otm3`#}t?OXe3Z*Rm?Z*PG0 zDbW~>q5gq71002#uoBA`VOZdHXi_63L|hsrBO@axCncve5GPiVIo94Dmii&*j)jGp znYp>y?hdx2Wqy8f=|Y*pcKYLcBs@lY=!P1CiZ#^pxVNF6R|kDGnb}^Kt`nqQ6kLh& z_qB(Mgi?#jkLK&}ZDDEr66P*@e@d=}Ud_e*!q$12&_jHH@&EJ=s}*3ROitb#2tKQf z&hoH)%AOan=6~qlE0}s^ww7~SfwUvzUvR3kx^83|S7wu!Vui`(+NZNE*yeI;8%ae% zLK65%fWI^_Fp&OE@T>PPeO?#~LiIm)_i8?#*S3X0&?VBV+O!>b5<-d546>>@rn9-Wh<5&FDBAIKG}Q zn@(>$wZnj#CzVoVxSK^fsA2`J-EM~~9z;AmeEN`HlE`NDaPq|S@uCJ2nJz5+wg4G- z=S!C7tl2pqZQ-hM2dOkJT)?Psrt*63>`l;T)gNlt873(ew=cWxN%^>lSi|*!6?qA* zR*Tzd>RdVtD&po%N~rH%Po0y2#uiL9$YpTEuAl$(RZ#40e{#i70@P5tQ+@EC!1~yd z)Zf8HS*ax@&8f}5D~pmVn^RL$fk%a-8~uZc?oby?bMi9tNXmbDQxsa56%~FfE+{H2 zw5Xe$8UG#)nV5zgkAZoD&7GX8oh~>r_xAVpc6WB`CfRo8a~1ND4!JNLcjvRcGw>Fh zoR8=7y`TAsdq3iHyR7_K%@zsE;Ita(vNPxj&tP`COZ7Y79!h1jnm(92k1tVeH0^*k zoNv*oSKB`(8x5k%IeNvw^KJ5zcnn*y$@b6F zgQrA54tvlzDH^Rs9HpTtCWwvuvMscvSu*LH0X${VEQM@+i#hg2lgMmfOd27X(=seM zDna~5NVfX8x>z3pezBS9sxCV4JgJ~$d0K64ZG5o*+gz!zozwG=~PDG^@|3F=M)C3y^H6qVT}rp;mU4+ej3$|-Sg5S z*fV84e-|rUd(*XgQrN7S=bN4KcVA7maD|42)g8|{-`uP|k~KLWvCMhz%$ijh1V~Ab zBQk{`V3d?l)6mT=I@(=(Ts72ufqsyUI9zNtJ`J@KbaUFxDbLL-DIlOCC8VICA*7|H zC8H$r{gGjYp)h_C^(|Q2%8tD50-Q{W;zdbEEHuOBn zwZJ6!*10%+O^N+J9U_j024Wr_`^e8`uj!#`ZU4j4SdYYrLd}&_36Vxi3vGFC$J}DK z=6DM18Gr;3)M^EzM7wB7nx zX<^lK3X9d*hB!dM3>K5|EZ67ZWES_4hi*wWjZ|hXuZQ~ELIw2gQMFWFGq1C$OvpZ~ z`@N@qcT<^*DJsJ$jQYCE)@c{j<0d#p!bVD8NMU`OOJZ}R znr>x+E{PW3eMjcrzq-idDPC8+rtp{g-5&=`Uxo^?!ZqfqU@OC!cj#61OYs4CyHh7~ ziNu;HEAY`L=mFLGA5T<>h{Ps;$7Z>j{kGmnvbD22hl3B180eFblCr}~D-$m@Ou zbuC7i#-MAtyJ0w4?~UN+=kFlQ%p@cv%pA2|WaMJ@?y26LG#*N4GFg(x85q&3uyVHmMktP2+H1J%dQbZ;zyM*cdrLI(F~AU|U$E z4AvrzIBVe?mTOhjw7Kq&v;c!Mzp!lUDDvcKJF}UW9aFXc7?2);2Xz89Z@P_kp5Ho@ z=gVfew75Ldep{Q&*StEMm-nz)(BbrS8O_^tAdA4}s8AU_O5>`w$+5}eb8>QGp@x5R#AC>iqH}0s;n#l?du^DcUWB5S1y;bmy@eI_?MG(}ZxHSl zI+6N7s^qkYls3QbOn)%H-bTRM9ErQ)XjpuDrR9!#$|%=J-EmwyX_b$Cr9!LKYP@Z` zA6`6(*kqv+<*v2JbJPTFbUlv`S$H#QB8vxgXj%9Fy@FA$!|VRA@~hWi6r}I!WyZmAK{=V5`E6Dn`<^Jo*^!4UB2Jeots@PZn@~dARt5M@Y%P5nxF14jXKO?q% z7OpUcuCU9sz@}TVK?b59v8M7>GQ2z+ufON99x&*iFB*=7t6tgX$}7ylzpk052y8q{?(Kn5#QtGeOnRsb zh@2BX2PL%HEye~;PX`>u2nm)p?DIOp;DcPr8Ea_ky5r+~u4IB7{l5K7cgN9u92E#j z#`$QuY5id5`QX0l5NvtS1UeGR`vvRWa4B?Q$?2cwC3q`{{v{ zl9iBxg8?rpF*QCaB_Zbgys|c%H{jh3kGJi9@@9YbeXXTxll|&}ngW?j5~tn4EJL)6_iXIlFK>@S1@@ zhKCtuSe>QEsj!xn51|UiFj>SVv&_p1bAP()$)F zUPas###XM=szNu^Ak-gHo*!Q5Lq7~HIE&RkPV)68A8#n6TGi!2>j?mhHVLj}iH z%+E(m05nmikiYSg>TB}+%)?rMw z@Ea9XvAL;5-7z%VB;shqQoE(|x@eDk ze8kS7*=Fp184dA6$fr5>rZnw&?p&b4Un7d(E;d6ksi?#KhOp0k^ zDE3L}EJGNp-`iNi+nV~h!R!WugxT5`B|m(RvS@E_FL~Y#mus(X(qd-3{g1`*s}}d` zBZx`+3SssOmoT#LQ$`0BAL>6Q6QLSoT=dGMu%#icxnS;Y} zZ7{gO{?dP4E8_h%^r-RHfj02$qN^)sBQ~_8#o{9mLeyBns?MY8YQ0Lfqe`AbkV9GA=f=HzpBZ$t*W#gaE54{{(lug+FD4dzMXXtwESRku2B z&Lie)T-B;r(k^H_+uAj4?`^ECY#gjz^-b=NXTQJ3=f3i|B_n8GejZNAG5)&dZbutz z9?~yh@5KvmW2YK26LlIU@7R>{LAX(iT+Cn@9MEXEeMshHv!jd204g+P9Yv-w8opcP`yRe+GaJ z5~(0p2R$ZgPg>YKj!FI(6V0QVV6T2I(hICf)D$RzCW!FEsh=uH+PTg1=E z$O2#Adf(9I=B$OeV4! zYa6fecD9b5`u4j+Od{|b`CJ~R7J7mEw7x7+UR^$aMZrS*dUE9XL#!(yvA&>SX9q_n zeCW?_->N{A=6X#LAE@x6jz6*H1GfD)6Z9goqg?dDq-rQ5m&%hP3vrRD2_2nqhCaYe z7$+v8+dL(uq(Vc&Lhj=yn-8k@n4MWUqk)086{4Z4N)7E|{t|RpHg1_32cLR-6PPm7 zX0eBoxWX;`8bSTX&xlZJ-BOb~+?x~b*?S@Y3`JoK-kYC4Yy$0D&gN>&#Nj8mE*Z}! zSuQq1T(*yR-pi)4+qa`#XL7qv-~F9q0tCaF>V_@b!MR;BQI!)qn`KykAt7H_&kr{M z5c9;r3Eyq0mqFAf)axxN5gHK`BzY4b9iJ4Jl$74zU&(~3N z=i;xgjWL<4d{OMQn3!(*CFd{5{{}+k9yAjZBq#bN&Wg6!(;*-2*|RI#O~XTujR}YI&7DeE!Eo{Mqk42Q`NF* z9xdB}ns;|L_O5_=x2-M9(fC`XOSqSugq)o04*?A?U_RsFp&^AmMm90tUXxxeIVjO= zX4Fzt{h>NC9+fmA7v3^dqMw|zt50T67Q8tXR@1F9^2v7H+B&gF=M$Sj5hj>Rdr5>2 zFkbV`=y-)mi-hs_K&)^Hdift^BDk9$(P$cmVt>JvcR3Bk7j#w0URdgXt>gwhm&^ z2rLfcwTq;xZ91JA{o4tntAi>2FE{m^b2@FSj)RvSljO+IBWQ#B^XepqS9x=WtDEcn zO$!1%GNN&Q8pin-ZYCyjIyyFTaw;xzHomq`HpuIIC#|;PpI_&5p-OPfqZwymB~Zjg zQJ1P`GVjGad3LC{Sz(``yAe>^w&w9Hjo9 z*y=goWVq+5wHjt4gMoQwm2#a7?J_HJa4hW?V>e0WuxJ!EQ@cQoak2s=F*J5b30aeS zPSr|rtXoXK(FeolqyY4@^APdDfnxLBUGx2FHs*sRhxQ6RLI1F1db_<6j*tXe?Pf=a zKVnMVF_&(od)+NLXzB;r#`!_N0^KnN@39Z>yXMpLOZR)iZ`5ZBE@HN}v)g?;zBWNY zr#RYw?aY-K`lqrKIDOoD3X{NdrG)CtpQl+T3mJzAvJ@T*5 zG&IDg?YfC%M2(q{8E*eQ+v2SZ_FdOeit+xO;1=Py^WGskjI)N^g>p8YmVtFkwaO}^Y$cn(eo%;I3 z9l9tT{WX;63Hj(YQWCP<9Am@ntxaPG7r1hwJsPt_`AWIa)cFURxuRe<4#?)0YDXIL znM5+xa2_Fn4YK%RwZx<(9Xxh#lUgP>1~D5nAw7N>V`XEITovCJB`+>WRloRGKn65= z_!CT)2i$}s!f7g%%5IjNl$3M}_*g9q%|pniW@bDN3CzoUB4LPWichO|dt}38LS{09 zQsYK!?J1ynKq$-1%q+?)%w7f?B(%P{yE^1^>?#1q%i9x_a9z617fAe66r+RFw1lcJY8bJ`d$Ai+X?sBD%o2*6#=-OrD=c8pd zW!KDo>jhcLwfzDj6mH!TXH|?7l_ANGvy=)W7l6g4eOXouzba2jMuE!4Em~TT828&* z`oW?9+pw8>Y{?Yk{V5Vh^iL=q_R7j!gZ;S`j_SutkMBNWahkTT=n;#Ar_-;usZ~8` zR2a?;ATEFop{)kX9X`E7qdJX-R#py>k&fG?_527PJYLVO!}BczF`DLd3j%rGhqot^ z!y9V!2byx>+P7;cm0>@Wk`vOGprMDyfNAQcxX?rg-Kh66kEKRv{3FNt#95x!Yy%Px zp^-GZ*H$T9MvC1L>o>jB94uC8qtp7=N@7pDfcsyEvOzB#@(inSB=R3SluA;Fju zJ-dQm9Wgw66W7h)AWnm+d+6M8b5tUsVN(U8Jn#Lb9Bz z)zohDjtj=SNm6boXy^%%@d}ENsYBi2x$cvGvg}f>t0M;1rIyi)cDoP+xYMO_BFb;QL4uqSrNS88|2E``{_p52jw-%ZOew1eu7Y_`Q zSLz*}WWuQX8JLrr)#!B(x=U-i#-yM6RTZK)EnYPl&#JsVqM=m{cB6!=?*wy{C|7H|3Idtg_EEu%E5wPT=h4s0#clF*3VYG$u3 zB1>tct+{ir7Bf&BQ8>h*6#=6P7SL2P1w7yxi>!=(fJnK~X17d3jQn7`hw%;6uAEf3 z3JPBTYzxF)g+Xk zn8{VLhXKV=pU9D?$^!=KAwaYy&sZ7FSP3sNK$+~;I6u#Mhdb}QH(hLUjn{IIgvG7@ zcSvp0ctoexczt>sM;p;W=eF(nW))ZdEFdzl9Lz924hGu=QS8oPVkXVaxlGZ^l+*r^ zQ&ko7>aCjtI~bWAW*NF^F{+K0%@J9P6bNJ3yDqA4%!iE9RH^xxX|RB-!|AYV9awT# z<{!eX%M47;1jdzXsWi?iRkm-am8}OM?*PAww)f3z_LO^AdzA3ZuG3%U0u(g+wss! zNi0Zwi}tOzx7$;4q;F(s=)25F|L|~cCgY|7k)b`dr?6y`NZnk8gOV#;uAy7gC&rCJ zuh%L}2U7cl;%LJ~3M@4r77r>lg7@BCggV3(PL&yB#`KSL*+LvCs(vsX9vOG<0DusP z?6I}@)MEO<_pGQ(BPQpR3(PSC=$Gmk)^fwIs-};ad2|~cCbJlDb8k63P3*_*^LB~R zER4TR_PU0xzLMmoKYI5m{qZQG*H!vtBzRF7)9i5dG zEngWtu&0h?Zl2uec8AM#y$8t_Er0Uy5BPNqF4)?>bz70bx1pw{ zrlh1TW3ZbLV5(ARZS@Lss)lcwf;Z}w5|(B>8`$FvVQ(T>oSYsTn;0Lrn#pV_V^yx? zpGgnoeG`C$&t$hXRH%?Ys#W1~+c+#@F;luw?X(~hlN}&^b-==5yEBVf>|i33R$Wou z>UKVowlGq+h{t^;V|nLWLqSJyYWs>*mr~5Qui+=hYBCDT`e2@gI@O>UoIOS7NUoH5 z9w?Qfij|l)$En!ZY%AG3KYqR;c{Oby`2+Z9%eD$>@MgyHWMRJHs*=0bUh+`$W}qOY zq~H@DodIbv%N=lhubn~@8lAR{C_dQs}j(jkUha(N(oi@*}ijxemY{xd5nAUOw-xkNI?W z`s4tE$b-#YsM>ivwFcO$2|O;6ZMATnh{xe{HXD^qE|bn_V`bvpKQJ)gGrcr-7@nOy zdB}B*&v$)(e(Jh;es{;4p4)7ZcQ=v{|wj)vwqy zp>8BgQ|ZtNk%=p%*NDoE))*W)D70<%}#nj=o{MPt!k@7m}ffO$CO)`vxhZ7A9A&Z#ly90|y2& zt6nUnS;@*xGO34L-p^0w1F?k)CPRr}+wo?O=V6^@k4v|8ToDnCP{3!yduT0m?sPq$ zdPJwX#dUIINxF5tHgG1nx1lEZ}DA3}@ zm2^f(Ny8viN-A-X;P^tj{@fbW5{*bTX(g^zvyeDP>6yWNYd=uJ<%Pnq;@XsDKxM<9 zM~%*l?`kFAn9u(RKlK_T?a#Ed5M8w7+w9jyn ztca0q58O|`n-?K)$T8#iI;wRtHALXM4W@abzQcu79TR+7+?3-y_SJm*?k+wq7YKT= zfr*{sfR4URQ(Df^2(<%&S{;@jcO|{O@$vEbo}GW`We^h!2zC+?Wv{i7u00W)2KDdG zsqF%YYLc4E07JT+=8xIX!fPYP>uGZ=c@t{leeoZN0eO(PuuFI|QZ6?2lPOM6*#d_z zVGg?5MTCmOWBzyE`l)8AVQ%xDNuNOzS=`As3vw%IB~oEmQc_nnHB9bZMWIAT*p;mp zfgM@IeucJftcO)Rq!SnY8=DhaSu(4Z08ti-d}ZEn6J_j2>&Aon)!v_n)FhOI*?>8J zrci^ASY{N@!h796yK29)7top)uU*y-?~fi+*q)C0-ujF5^mshpu~2fd0zQyDEF5rt zy_jlqbMyiE zs1%E4m_tHBI^JvIrHu!;cRl=YVcyofo9YV9-qS2sqLju7n9d97QaNxZF0 zHy6b*s?3yHw@l^TCD+0&*K86gU)Kn1Muv8q?bc2DWr&G14u|9S<<=HA5X;W2wycJr zlDN2>h``6&r1y6ouiKG*>(=u`3#HrCBs1uutS;C!6^TFLC8utpaU^G`h9Ebd0nV5^ zNr&Mx?ACx%i-C@w5U(;lbqIByy}?9KwtphX;uRJV>Gryh|Ac`ri=}R2L`ZC6w25-L z_I!fYqbbohJK}m9n?S)fv!R?2Yp*S+s4anE8}a5AQIZ3Jj$zu#s`1y>repIkT-jrz)P#sp6zn+na2Q&@=}9gKZYq1JR%cnc~!-kx{wO2tp;PEubK^lnW_@lZ;38k!iY4@53+ z!C!2!HuKWGu9e&;Py&A%d=?VYJSm6!0C(WC~Pv{He)V@Zqf3@;{OvDH*itc_q zQy-&+#f4&}m9q3fD6DF=$BDh<_hl$XU5few*`nyp$tOg9emyw~VH%!JZ9&n9l#AtP zND2tQ#&-Q?D%YhW`TJAfph0*jg4jc-jl4JGWpf_?rmBMc=0jtkN@mjQjp%ti+T6z; zYGX}QB^kujKW~Q>M-{ab{3W8z7)hVkZy3Dui=q=Bq!x=(Iv}ZUX86V<=*RJ?jsGIM zC{e;sqGSoYS-Npqbf~Q2aGpQd$rOBlZM{(GdN@FO4mgn*4Xw0laqXFX>z9xWghyB* zbeOtHo^BI()!r7|_aWsi>vFSEIl3fs^Qe&DNKQu$iS^qojP6^~O#kQ(r%TOekDE>y zGt7ZODiT8C^1Q`XgZvSmdt^KYv!m!Q7Hr2Hrq)L8`=q`3wAoitW*rQ0@dyBUP_!`eBrd7;-I*4=kGQ>fOl^GRN||5AjMDWDODZ|hhJRF+lKTo$9b=+=qu z9hkO{SEGctJDLO0iQB7uxX8IFsECX>_Grdyw=DyXO%Pfwm=otoWgBOLeNIaBt_)^V7ptbc zjvC+U=IG=ryzuf5H7C>UZs^2GnKje34Lj$gazjIOM6?veB}JKKxi(`pqwP@!z0&Cn zHmmR?Tb;e5nw1WX*Hh%7>r5&rr}FOoihw-%K}oERQEO0Gu_^L(5t!`UP{e%iMOT*N zhwVh12n;n7*9N3^dU}J~#w9n9gLAV=-fNkG2L@E)NkNkSE})_JOviKyFP&Ot0;)e#AAhzj4s5Riwa?F z))B(SPyJA}j{&jGJpZBk2E*)k!ak!}yIgsD#FUHeCTcg1tvT7`2y5@gU(iX5XygiD zb(NP=Hs>MGA!**%A3^{pkwL1${T-)+Y3G%n{KP#n$sEqz$xb2**SPe2-j{hX=Zm7F z+AWA-4?U+r#bVjC=4_aw7KXD)<1i_oDHT9HGG!WxQhv?Dbxez+)mrQ5^GQ32G+e}k z_790|&r)2^kvz&havIx&Pp{QyMj&yU-F~pH9BR9T6#Z~uxu^_cz$sEt;LY;wJ@2*0 z0chd0@p3oYowZbx-D0hvU#K-iEl(bY&uFp=D)Z972cE@-PA|-|b=F5L@rAUCyoX^##6cQS`c>6aa zgXK*CzN>*OO${z(tIe~qxqH{w*Q<{#>}~H!LPzQ30Wv7w(rXbLhDN9c|2e>od+N0T zFs$Q*UBQjZJ6r7mO%hx0T}CvQMMVGp?vBW{Re0a`C(nAD{$xYcXJ_gVw9cnrX8J8J zZ?g;(pWs+K>%VxodRZXK%mPeBm!CX|0l6H7ib*?Cj{g_f9IFBn9Qfll*1xk_50{r- zyS7!^of&y!X9)PMlWNm6eF0Ykwt=Ay0CWUccrfZ#Xk3hCZLhH=o9& zMmL27RVciBojV$f6!$X9=kCp8`3tNON2_AAxVX3;0zqq&$E6rTc&MJr8Zh7Nv$O8H zyS(|fVS+yuY^ixCJx2`Q__ZYZ0`;DgJ*2zMtdq@o#m5z|$^AE57F*{5vi;ArnMVqk ztO^J5{+oMIS)RHAiTEPUfec^WC7MXw1G7F)`)sx~YNH~(Gs_}w%xy+(@c>w;SH8T$ zvxy2%nlgjrWM$>pSH~;CGyqr4ap?Onc`n+Z3_kF8w?QQW*<|4e@!t-=TA{wh#bpj) zWoho@$j#1%SgftG)Wtjb%ya7(*v-87k-?H9fRJt|>*~MYpL9Lu&Z!}OhA7dMjjwul%$5|8QrNi$Mn_uwCcUXhE7)>E98(Ail~P|#V?)qrTO zOQE-?@BRDt3JTwsL|UE?Qjt?qQc_W|!_0#M@ek5SX0k}Wr+@KBifmz6#5N&ucOF0R zw^`K*|Iy_E{+%Vey)9S2Gi$|1E0RoMTj(lwS?SDgYy|jDWea=v# z%P?bF>9rZKX-;td(muENX-V3zjEv_z?Cc@3yu2mKsp(&&YYLwC^!6z9DTFBXasBD* zRZvn=V)5_mS=@jBBYlz1m!i9is?%UXQZu(T)mst&^Fm;?*S8q4Ivfg*foKcQr^QK| z+cfS*2n}~}-j&-iJAztKj`qgn z$tPzEPa6~+u;Ac$msUxPoT&eCAesQ3nyc`#P)5)A%|5_+fTrEd%j2^630_y4dSFs= z6`p`jm9VvK^qL@+2t%L zPudLB^aB8C@HQ*X0<7-r9 zriMEnoNW$g+SQvR(JFL;d`ea3q!?L_RSoA;+SM|1fN0WPTb*3I&o-QDN3?}>r6wT_BCHi+qs=+}RZ z%mp>(nw&NaU*#i{Od;}iw)JougWk&N-irXO_dM3cn-uM1xLF*1`C7*JaXy8ne!}{k zoVCNd$oqjYb9D5RCkK&<=%v@p^H-8}=H7dM22Yi!c@3Mb#z*Qv9BK@rrbm^YN>u$x zBA&~ghbx?FsWl#ZVKy<{5lrG{V}V@c?;>cVvzVjd3%ED+?%NaNX}%3`MhQ3DlFWjF zqGFbkw5ObMGmM{+U;Ll!g+s*3VO>A{USOhzdh_rVHwx#Pk1N-WKiS5Z*WZ0d)J<;+_5UU7ne* zf<_CXd+j8&M~#$ASaNb-eU12HqA&_~IO?vTOCZ$L26WcJ3DtQ;*f;v2sK(iUb1_#6 zDRQvC62K~um-P)Hespr&=-shZyE*UsK#f6oy4hwfpORlPw6(P*0#tUZ zD?rnI#{xYK=YSoYmHhQGOidnl-bk;Y;dO=EvgJpq_LnZVphMk2Op~b} z_T=T+*lYq^HP?-wr4NZVE!8akyI+Lhz`kXm&rZ62clGnq80TVqEMB17ub9JJV}n_- z&t?f^%$Jcs6WzHB4F8B_^||!`DMUnQ$dA8tms~88k}rq$^9pw5?6&(z;S;$LOhSUw zHFr~pP;5B!%jqiL?r@_AYI+PZpUUl$hr52tHz>oQbCu3>y#U>@WV+PqceLEY_5MT= z^RroTjqV6$P@{j%;PW37AKxrhJmt5S{P#1*YW$beu4H@qEQt!G|BO&o-?rMzOVWBWwk(vg^j6w(K_8z)y33| z^>?TWoTL}jg1swtCx-1=kXbN)#A=XbWD~?58+b7_1q^mmWrDs11qU~KAGVJFUb`LT zbRY%z)Ps8ZCT^}xmflO((;A%pyoDvx#?_T#o+qteI^L_B*1rsVbf-6t+yOOd!~S;*bLaE4Ou$l%>kWposmFYpv{|55ld-VRq$O{{Fpk8d{RUzn%| zlygIdQ?p-llI!wOD7!eR(f0-4kv%hTi9r(9Hkcvty!)-}D6AErQ{UYDYNJ&{NqSx{ z-riif8>Kjk&vkk=d##Q9ei)BM>puoFgS|Fd{YHI(*}TAfz2)(`iY|IvyF|Clr)T;1 zL+XB{H2l>$JYOiIR*vwIXsk5e9fhQR*OGk;W|Z$7GHsdMOURmDkzobEG9Ynu3;|AB zoK5?nvVdDwrs&sfQE$!)Wt$sM>rhPHv;rETm&K*{-i2jwCOqW!Nytgq4lrYVhI4uO zGc|R;fEwK-#Vm8=55bY_tHKhl z%rAXr*&3L=25@mcGwOE_u2t&Tq4#MC1)t$QFS>UtSbO?Nt~^0Z>&!HnpzrPC5JFA1*=WHTHffJ> zKS-p-zNN>-v35Jyasv?$Xe#Kc+ROYc{2-( zN@u(usL8@N!^b1+q11z^plXu`!g4l>>d*X`6y|}o3w(#ktw_h_kGvxPTE9JG2>o>* zD!0qm0ikDXSYF?};yW<6W4Fh{8FCRjgY63WC!sboO^Nav1sYG4^HDJ|&Av+CGw-8Q zS=--!jY8thU$RQIoOxbePmkt4_ky?V!_UJ*D>A=+{kmIKkYI0L$jb|8H{{_WKrjwH zqmWGAnX7|!hZiNQpEQ!mq3v`^4C{PoCyv`~I_j*pCF4S znLp>L_GdZf=PuLFwk0O_o^r-CVTbpfsN=Q5!OrPP4=X_PoZG9N zZw>;sl+Wo_oYI8H_GNz_5TUBT#|I)*BSz}aAh?F!ajx8QC7473ZKus^Qsy(9A$QFA z=;fG(Mr_>Ub#p`v5strLBSA7VyU55vIXBP6+1~Jxr1D*$l5W+$qy~8Zdu&SM8w!3_ z!MjEt5*!?ck+AVy{WbsrV1p)~ROU`2v^C|bQJKv?M2{XldtLFcq+=(96v8O^sZ6*sOnZEb-waz&3x{g zN@5&;8s2IcVN)un4Q;&QdsIwxw6zU}jsL}q#4O-RSAYLD`rOWLa}l8c(!ktrIdnKF zsc0ms#IU-o`IFnka^dey4J*#@XJF=+!ot%HkaJaY!}G9q?CJJIpLSEkVab@pS{i1P>t%dJ5g5Y{8SDa#HgyM$iq2oFtw?i4mCdu^6y0=7l0c8 zyiS)9ob#S%wGlfzTg$5(PNVZwSC`RM(nau@}oE;e*`a%uL(^t27S-1Q1FW?lZ0 z?Gd^DnADVGFMahiHZv*)U~^1=}TXnAE+pliRAg&o3>-T6dL)zQ1EQ6siU3u@2>TX?6o== zRj%q%d46VXG12+S%QgfCQ~gYa9y(KLIxwSE0LUcDJpOL@5hS@}vV-YKj;LBKry8cw4 zuReie^0{ZDJIB|~ijql1cXoG*jmpdFoR%c>yhOUaqyx6|m6es9Oydr#i~h^}r>873 zYOp%Zk5ht#?~EI3=^Ms|bzF>7%i~=10D^w?NNC+{_is*!n8PONu^kgG;bqI;c3hlR zwa=#$pwST#N-1h;axnE`Hq-*E+&id%b`~rv(>!2cl0QA}B#|;{dDB*rkc$O`M0@9D zD94q>>D&6bDjpp^1A~<&EXZS&1px_#B@A*n13|Kq-4g?PR7F;5P zC!qbo50aH-U#&X1;;s65IX(#(FZfXw!cl#B{iQDT$TF1TI4F)f9+eb;@dRWCnNyeB zll)OpfZWIedUa!P2WWztJKHKIW4b+{SGPzoUkwAJbE%PVhO>%zzQ)`8X)=# z>Uj#!sS*&}tf&0BYy*GFScZ2&R6J@^e>NCI9{R(BE=e z9^2w6#9p@tw>Jhd3zO0%#*M8&ZZe}GMUj!7>7o<(P2PA(`=9OTg^sRUowRdnjQRos zkeQ%&(*M%-cDzcm2=ASvy$qg;9+#l$YkgiqoNHgFsNXvxvyDFYSfYho^6BU#7)iWO z7{#n&4D8{*OPT@8g99bg;b{DZy8Qb5@{Gc+!Jx~mXNn@`;j5x%SZm;X8O?S2sC7!Z zFZr)TI|{17j^;*4mZJ8bNC86_&OFnENECmHjC*)FsJKu<*`?!b4@p0v|WC}Qe)t&&=_tYiGrsn1lsJ{0V29Em@fQt!IrF^e9(ywm3 z9f1A?i9|9utyk~H^(F9QbXVe0RFM9Ge+|~j#_-qYJ|ffaiX7;HDyJH{GGdeY06wY{ z^Ms0Gac$k<;X_QT34u;BpkA$Pb6KY*ONiB&7#kDbnRe{VLR3)MOTjRrhdL${fY_Pw zlPUK7jGvC19AO-_cHnM`TAXAq&<3i*yXGXzkgPItvVk!f+=Y;Z$>(st@JuXc1e4cL zm+7pFi_0r`brU>}xbx{S2&E$jm0sz^HhIJMXPRJFXS?*&s&q5Cp{S%V0sdm{FWRQ9 zCiq2>hzAhMP{rOJp8Rdv69xhJbrxW#K(j01F>wj)Eoou^77o+eJ9x6M6&JT`h4O$V zmxGuzgHBSSQ^Iz`u7aW#Y5AcK9z=z+IU28+((s!|9-sIGBuCG>H+Y|u<`tB4hG2kt zkY(PdTFiImI*@h*RDRrs_uOl~27)d|Hq`LZ$&?zrgHq~|8E=%4TpKO!@EZdzQGU43 zoaNk%z8c^BeMAegJZt}HP`xYVaK(&deqL%P1AI*ptlUEI4`nSh5ROp zib85=eEfKjmS3AVMU#P5t2NdA@Ck`kWTQhah>VMRYUQZ*4qq6|;5MrnqWCkgO zj6mtJK|vZ{*%n&P&;3`f=%z30&OvI1+NXOs@h zN9_T{Jlwpz1+-sIXaNf>p!zqgVGqST_mK7{tsw#1I5@zsH=;UfD|)>^gB}zF(;ggik{Z#??CgL3(=47Nnf*cG2(;~o?V`pKZ7RH?*hL8mS1cO&7N;5rCQhw z&}vLerqK@WhDHuc#ipdBlTbi$88BI0R5*wPM_{}FqCcaIe0A#izOlI5D^4h-r;YP7 z<6kg>TisfxTk1#Qfb)D7<(Ml;{TY*pUstpW0O(8kw%rb{f}(fbfO<$#1r5wj zKhFccJ!6??u@K4sGBe7b_!{XM>zhMtZRjzyxj+@q$;l2J7j4H_H8L_&)AY74xck7Y z^XjTez743=QlEik&O8nlnTSyT4z(;p-~z|A+`%u=K+Rpq6b#eFUowPjpv6xW>75^K1iQ^63K0KkU3P zQtkqPu*XLaiHP2t+5%Qer=LtA_r`l;OtJTR2LXXC8!xf@F&jKQ1OS}awC>V&#bq7-lrHE z`X7KA%S4DkYdtS6F7F4*0y0BQH}E;Fh}UxA{eqv5l2WV7V15_vce~v~YJ!S+o12K~ zI?oNGpgW%D&tH6v2Q0J4GUpkH>DJbC(Vghum5Mat)6-*vKnM3k^4&ZCpJB3XAU@Aq z8X7=+4fb!Wy&=K?a=YWhm3K@`kM`!WyA&nF|2661+bDj_;y6?(-+79QLMm0v?<8%w zaoDIzvvshQ`N5`8fL%^xBH$JUFu^3?^pZC7`6?LY@YII&qs1jy%ekqE`O1@+k06(! z2Xpt{58Mw5{P@p=>J+#K)$ld_iSnv4ftEUqEd*InUM^$}@A5P)8%uaKg8rOs~<2>o>HDayb1)+H42)GXNz+NA5X8B ze*@XnNhA8*Bj(zL7A0PX1r`JbP)8O=7o#R7wBxanC})UTg?ZP*ZulrZ7|;KSn8o_i z(h4WxCpy57>Xb>ubfSC!{BPp9eBHX8ZSrbr5->*?1N1A`0X`X)NhzTl6z$Exo4Mu5 zyp0x7h&F}HWaYoH|FN?tCtZf(u#X}dR|@z2@f?X+r=8-j{~sjSh_;n8^5lP9$+J}jyi9mX4;A?si zj;tHAUKoy{-Z4a7G~PUBAiDts$E-Y@2_CfKG5=e#`wR^JgWPR@jKyn>^9+@_iW zBl{WZq`uO)iwha`Wa6XdSRpSJt=Gm(mH+}x0nR0p;?&T?00aABfKD6}Zn~7-#vFxm zHli$o(2P_hPy?-Z>fC<%#$|ZHHuU4Uy`y8qGQ^;<845dGmb2?4?+Seip}+85vhC~R zfBy98b8fz(tnu{8gPu|9q8a$q(Uu#v`@ZPwrPP)#AEkl8ft~?0Bp;E{P?tsaoOd+o zPGIhxI)MwpXaA6`EeRKg)Y#nvI@6g_(VWuU_F|D z{SO3s(|97kR6#v1yfZH)ss2Qiqi)TWyc<2)b0nhrsKMIPo@WeLJ9b0pKPVz2O;7Wq zyn2E8r19G>WfQYXY^#lufha%o!skV_;KIj`AR*Y%cLbOCq`lzinBfoq@z$M{5s44( zk!szRYo(jSICrGuObCmz$kd*tr@&{ez zkJ@s%$Da=?sEX(9y|&6@`Z6JYZBb=qguqO9BZf!MxZTfc-quRLvAAGSAH~7PAz~FP z^zpp4UIgb_X{-ju{t!$qGrAk*M=7wA^16zxtqtbGfMTO1C%=iy3J&@fS)Ske`P{-7 zsD^Fob~i6iHd!AT>bvdlAsgHsz$-KP$yu;O@%;>|fu|pd^P+v9sr3)X-qmV6YP|C%2<5@BvpYD=vDE>5~;rj!pAj z$~lsjfacS4JoL?O{dZ95q~E@{C|X=i7jsT0;Pp3}_nWGTv-j4iFpH2h7i)xU`UmS$ zJerEESo&wj*;eN6{UkGWVdhKqaK3^vQ17Jt(_0Q;l-)Qi!f?=E2!Yu5!{8#NAO`KY zlrSW;yFDDEYoztOA9MS6d|^K{wS+&ue)s+ZY46skXtmU~GA&*B)c@?5TpFC==q=i} zyUHgo$75HckYp_k_VN{hm0Z4q~>2ijjTz8tOlH!d_j=z4R*ldCIc1MT@GBD=nqaZ;oMABm@F5Bpm6UE3K1JlR!z z$(6q0u3(Gj8@tzf86(tEO@~sHo|+H@2~pu>@K8qK?URCEgvs}j zx|8RnuRf5g;V<)NqEZUDc|28q*q-!nQw9%2S`00vMGz7JPfmbTIhZDV7TH@KZ*DL+Ud;k9KFZYHBoqx*V*czKeg(v5eU*AId7yQ zylR=1&Gx%9GKH)K$48+eHZ0&raC1=6TXY-wdf{~0)LRv<{pOM=eH5m*B4wS;Fi-j^f6_meJXzm>*wDDtS81cp7>%{HPR|bDAhj|23 zP*OUF<}apUQ)U@xBq6PS7{!nf1}SrQ^pevI?8Aq}Nq!H@xbt`WkMi=z8r)3wtl6HA4P? z2~(?H8URURIF>U7{<};>R#XTHffiqeWpxI2UI0pNW~Zm}o#z5mFJG{U;qdsJJy@#X zhu7bbDv^30u7+dAHLhw3^(6df1R!9$w<>aqk6W&{r05Q*S%{Kd-}gR$o@Yy|@9IV) z2A|k6dN*j?vVY0-LQ+JKHC6VDZ-pKM&kDTDrF=<737@Aj+MwY@Ad+W$n)XVWof{6E zOCtKF5Y>4RD=c7!(`eW~h(I)E?p}CIIfK_959;LsnRuD1q&S8D6QjY-h>I5|f*b)xywuy z6P=u_mNkT6;DO!tEZ7DP@R9q78up|j0K25+7#At<LABDocEmT`~0n*J%quUkTHyYu(}Z!(AaN&Wrz5cnXP& zd(KJx<>H|YU<^!>w>%53sD%f&f###|KeYB>f)N;6j}u~a^~#DV&|^^2k{vSAhmbK) zJjMaX_~0H^JQAV83q}J>k6O32)uo#T5nhx?zQ4O2tJ{4~JsYkpNT=ExS;LR=#_D8) z!2M@*BA&xZMc?@6d{5hCUJ5+}@wa?dUNIID6}TYFd{g?ifQK#y)ZIAl=Cz^i6#ujw zbZ;1!%t1~xlDuma6kjn=0SX1nMt7Bg5Fo6$3^N$hMdy%fu7&OiQS{Jxva?0Y~{FQ+@pPQnx3pdmu%i4nH(byd~c0VG@0!hPsh@ zci&oyrhR`?BWPPL;3Qv-q*zONSHK;;M|)mF?5}-v$|b1 zm4d2Nj>l21eJBx-ZNS@4dOcQ{lWjLsg}#_Bs9_Rw-=2QZviK{DSS$n4g&63!8V`@T zui|eHJh+Xmlt_ACTQmbe!|*fk)aT5=lUr0>JRa-HKOo~t8bQ=rZROl7lYZE zGM$~j+1az!D8^5f>%|^1fnn3t<~nn!O?Pxru}M)%FM=&KQo`&HbO`q>;VNo_(IYdy z74(U%hI)P7vupx`_dyFRMeB7mg>5qr$);()Y=~*r1R*_P0==~^Rvm=`#2$x+f$z|| z7h%)1+Z!R4!Or#3Y_GxQe&Jp1kjFABJ*Fvxrha};Kc5{R9-eufuA-7LeP;lmP~6W8HWPI*r*tCF>FT$+#nK)mSpBTE=sy&6Uk4~boK{wo z;j#CXlb(1~8X3tvq6c2+BJ`3A9=t2rlY(N?Rf@hg#A);zY^{&ZYOiJ^bdJ@M(vm%!b zt=LTai1S94o{}h|#QyE_Zmy%u#|oE+e-6ax`OS*mVo5j!U|nyI@)PWG^jp#Y5upmU z5)`zw{~IZ81#|d_vw&G2GkycS6DESFIeCb|Q|p?NAez}2XydfVPPGb)sg&Z;@$u0? zIOYS|=Bbw|Km!hRLtn@$?i^iSxlg%+#l!@jAM|0>_DxzmTrsB;1KZT9Oj4Ep55A|o zJA>_56z1jNufF(_^Xcgf(_;~(-akA%b{on1;Iq_PkK?w{VztI*zq_c|*H0-mY> zghBJ@%G|JS6#)Rl)L%K{)TY+DKbtZ1;6RYD7&5n}gf zYhbt&!{lnS!MPY+gJ?G0^DtqK%P;JXcvAj%OjJ})C^q&_ciML8bM zMh!cu&Tp^8;6kJ7@)`nFG zISqk~PYwS|j&O|gG0l?$=R$~LPr4M|KhwTrfXHFn;rwvU=`^4wf)E}{pBkpkwu zVR|6W2zn{Ai!_uGw4bC(YYnJwO!=R%L1Zz{IG(ZdvKJJlTaMMC6E`12Q+AZ4k;I;;cy&)w72O>EXU2tz0Mu)0L#>TdC75@kcCA~Vj zt-D&&cu-SfBxbkOS@ss-FM&(_OZG_T>fHoIhlW2yB?OzvTgg{a3RqLc;HXz5RjXt7 zeC7Lfo6g6w!Te2c&6YJ_pAnm`R0VZeC$pBDxuI>1Wb=-RC97=siR6I>_h`&zN_ldy@t4bnIaC7`_QBtDGG9 z6wO_ereszLs(%{JBO=?G`W&MxHT_bnhCcs@CZD$~G3Cb(do&3Ot-8qDO2h2^zzHIl z!C9(LjVNiAX<&l)MX>mP3o5GsemM1?tsF3u?O&cksGDP#>)~CbHL&ufIhYqgCCFa+ zUI(@l;7aeCEJ!u^UUoL~_F+}&LBDdp8d2M6yp>`FX_(^yZevDnmiNVNxST0OS!amE zww3PMu?jH;9Qw$YN1m^ zJ17jc58u)g-1~B&ScydTdBE4hHrht2FEb%HgsIySg`2)&RHNiq?}7>N`5v z^zN?07BgJ%Xx@kLr)qC6XLO$Oo_%N%7=ml&@Z7MN-+Yj<;*&5da1#DUeBD@>M@=|O z*ecRq1-ltSpa*MFHkv!@w2pNoe|}T2~qLUucQ>@#K-DrPl7gAr`$Vbw$IwB zW^khvZNy7eIKQg(&-SiMSQR6WwbZ?-VB}w1l6z_Ym&*P#hkU6qiW4@%_Y}u?%!|xV zKStpn*`h8_iSboBbEK#jLojtIo@j)P;&8f2qp?)8_s!05lfmSR6lsSG9LUumm3)0t zK0pyTDhI-ci0BAM&*tR>?XdRu?}`e2+;&?u(y}<2bXc{#N6fDhX&aJm#T$TcX6>IJGz4Rv3*ol=f%Js)ElttJYaPm=r(P&I4(@dT7@5arQ;1hUhg^(by6SX7p(#vDnQWhWF zKI7tg#=#M6n?eS~`7il5+gj|nD=*{Uh@@)!ZpF!N$LscGjf&S}{fj8buJ8|vv!il$ChH9Od_{*#7*P5b5*sis(RQu!E{wNTq$NDsa z{FR1SE^w_oOj=q^h(}6XT#)+@_Vn#!#kcBWJrVzzsq~wa`su_C+k!SS>JPt5UGsxY znsQksh|HpefGZY)t&AS1=+*BY{B9_@X*Y|8DaZ-DrB{Ml9RGEjIH7+Hv=NVYBOb%4 z*wzSk4OxZ;UBi)~fVUQh*(x;v9a!da{to^Ybm1vo>%4bxrUe7eQ1RA01Bep2@8g$! z8HXC*&)&$&YQE7{G(xwh?|--9IZJW#zkT+UTbw5qA8ZX9ZMA)5Pc=kR*m%|^l4`f@ zdSjbJ&}leeqNFu9#QZOY8N+g@t6MiUecE8V29U;a_`tBp`4M6?9^bBhfRR%#F%=mV z^@N)C@A!FBH%6o=P;_GQqZSab(XT?Lzn{I*RDQ3muGKv?;`e7~ zyg{{2`k3@4Dpv7%hLAX#cmG4fo*QiL#jd{ir-2b?bFzw0H!i%q8;>G^(~wjyhNq$I z_JOd=`U&rgBE;7(oDQ(v{z>65eNZX4C`g!#k7Z-DAt7Rpk72sbZ@5z37Z4bjK}`!w ziqe6${_B$pvRzz;nHRYkmew{4?wu!E5BTO!4+z5*d!BuuX&m9ADyh{gP1?5nN|T-AqzoU*T zMxU6o-jiwabeTNuZ~ob56~R1~S&^L=^`$tcKA+{klrJgj8)4QkS>T?LFUh?1XUNix z1y&tqulurWSy<{}8V0V({#4sf^>X6fgOrp3;gy)@P7Wae(hB_gw<~t^F)mfFL}B-h z+8iOM6gxTeV=t905$sXjcf&*^ispFk?xq4Wsk)CTwf>ukOB(;wT3bU)J2oLG=9#*c zNJbGE86|mw_Qy%VvTYgo*^Dpso|g|%s7fEZ`X(_|OhVd#j&u-4?^Ab_c8WF3zZPmB z`oFIqEUzPahoz5(A%_r{$UvPFLr~EV1B3h9`9I3qxy>Bp&0N2iU~dXI&!LH;&bs^t z=5Bgiii-dAUiPi`KZ1Y<$3$yQh*WRQc+X}Ob(ct;5dC;R`0V3msS@Wc^_>lTjvNXc zoZ(SHFCfKDPs>{VeeRZ@@{{i5@UEH^qGsIy^q?>T<1>lYwV_1O5uj^A0#5>erA6@1 z@iQ(|{Y@RlV=Ov}Wjol)Gimz9D#7*?7=cf`+!=w4ov>rn8od38LI$2v3?pWlIqY@} z|MKkiw_N}4A>`@1hUg((dUSryZvVrybR_Ld3C1Z}wYi+f$7#qWsXb$GlYd7*Plq=q z$+}ljF`$)pPK0%aiHwj|PD=`AkgNW%hNXw$My{3me(z8^1(lj`z5 zogP=%)!RI@grp-4&DW`lbh3cPDs%Ya33cV-b|>0LDvI0o4R$1{vs9wT)YW(rDpv6$ zHUYsveLLR0@@2d3ZF0g5sJI1*s7{IwNU3Dw&U#bH#S-n(tIvUCe4uPlw_SKupl0d} zjHQ*sW2dW%X2(wQI0g*IQ>^RqBK4+(L;v-ePw5PnNea*Pz1IKKrL>G!zmkHH417A; ztoxpr9QA~m?D}#Jbk4)+USuR@`75UCOLcy9Kp}-KS+F%oR<`qZww7C1k#~4XwGTSz z!9HH5hKs^W$+z_AK0eA

{|`b(tV$4np4=!^r_?sdW?zsF2>8D>bIC8E0bO-wx3# zO|Ng(RUg9!$MYRDLQ_{7;!+JYkeC2^#jmX%<2i!JL zIVc1Am@H0xT(}0t3F{Z940crq! z^dJ7R&M=GkB=PTGs}V@MH`tj3w7tUwNvP;CZ7t$;E@e!}rMQh^nY!t1Gb+NtM5@g0 zCYm<$YR0szLh=Wa3>x^WGQ*fN7XSsJl1_)i-y*XNg^&ZjF946poL$3iG}I1z_Y8>7 z?-G^iNI~%g;98z1^Hbb~!h~^#k;!o=3UacoyQR}i`UKS-y%vx4+ArY~1p3@S=C{7M zpP}-YEN1lOuC&?T5&uVqo*Rr&Njmrsf9aA`p^KC6*weTYUx8~RogBU>B{!Lo{nyDH z90@OOm`bjM6?H)ONL&dy#lv{8?XxGbfr$rc{LCiOu2Syy=-{ByZc>*m`;6@Trw>>l zu@yh9@nqR4NbJ4U5^HW3FX_=Ta+d0euLjtCMxQQ~u9pW_RBSJZPmaR0iX=-3lD4X{ z|5rkjMhI9@Iq_<*tj{Q#0@&NkFlfP$7>9fUOs%1CDZa^dsJ;*&UR?K;|wrQ_a> zw1;G)^WjE#RcKBG-J-o+aR~>{{RaEYCF<|mtSlVawiCW50afn?=R7EBOkS;QryGIa zHS}25aS2b->kYT+)=0n|TCy>{O}Ic+@;*F4T8agpe$+j^pq6Np6 z@9FBA1q7HWcLhGU^1t1!wAf?09 z{0N;RP)DgrVj^s=<|4%iE1CteA_l>^c@|kApi~o=j0aTMLH|LqUb_mm>kDl&YN*7% zzC#UrYpW?gLaQ%vu{fgUu)IZGZXrP#Q63&vUUosjb%V%-?izk3U>~}k*9VQtpH}Q! zZJv0hCZAU5ps|NMghX7JT*ghP#ECYkGQ`*~OjY8^@jUBVHbSZScU z!Cw|lU)l|X&GpyRX-+m0-r?_CG?Y(#2KonMf)^!VGesLh>5Lz$nd+|&QV>b8kIBh) z&i5|o=&8f^rz_3oW0!n)i^5!mwJ0qQZ}_r5y1wqy+Vw{V z3Bd+uanWDvT|2YfzAREey+yOPr|zz@BFw^|IC&}FqD`$fsA6~@m@TjSG)#Tg3>xq&C3r2;l9S2n ze(sYpZLvn@fhqD{n`GXh-u9`waO-Uv_2=Lk_}c%TOz!YKY@gSMo@9NV$o?*GJ+(^X zCzw_Trp4}f7myCS-;!pxjo?=+3>+{UdLATB%S9;j#z$%&ICb1RqW!xbF%M;iB8rnT z8dECqxnc5^Bu|LyNh?Ta4@3I7tpJ;~^`L>OpD%nm4HpKq0u29@VE+a?ASHsTK}Vo_ zhge(@lE=&|kkMJT67K7K5^A9{b>VY-`eSFU`_i>9YfWse^|-eh@pvbzP1suj zX6SHv;I=fhQVr~Z2yc?K*C#b^J9A!kTHVz!?!3p)z`%^*$RhWaF6yDn)qe0O)uP$# z@PIok4!COYQR=p#YK_(5|8NXSNz$%d<--w^1LZ_+)usQcHME=qEQ-qxcMGf}v{VlI z$y`_91YTCdHWqJGv`-)=_;rS`G|K$TI^O=x7X=w39Hf5O@6nuFP zyDrhWlN*#G0Qw(&_RO!ywoz_ zrr+v=V&G0?Vu|CPiDaq6U}E#!3zgF`%IwG_GHA%J^2@1?eGM*q!@+x`RhX`U0Cd%} zf5DnD4Hz56nNhMkb+?yW^!6#W?JFrAzR;d6Tx;B37207)Ha~gq5X;*-NV#?o95Z%Z z96OLkv2K+u@9XEeJyskC3YKse1dVBHMashEE1$6lc{ORzM`X7mvj4Xi9;N3uQtaq8 zG9^#dF{c>e_NkVt6jn0u1TLR2^K}%w71S}OH)M||&<@^*#nr}&d!rUBcJ<+W+<$r$ z2+uvYynMEo6>k`UIp`1nKVXIHYvfp}X@g{`Wrjo8R1=z1LcE%{j(+KkXYm^X^+Uv6yOt;Qmfk z|HAp`6SI%Y@m7!&vxNg-YUsIQx{Oxt8xy73uP|l*J|j6j*eX>e-}}^9_G)U@IA?nI zh!L79OhiAjS>NbWa;@kB)Gw(qRvHSPsv4^`7?H)qi_A{a!;G6qvpbUIZ+l@u>_Wnd z0#3^ zILyT+kO)K;8P@IP@ltA2iPtf2bVKA)4VZsUmmQze<4z-~|G?;!lH}wjvk_Wf5K4&u zly4+xVlKGV;D&cubZuIjMY-rF{Ci|{!w=PQPqTXhkdDro%O+} zZ7LAI)^`9OGEop7WtSxR2D%O1(7y!BI)Zay}SKKRQ}IBSqF;rJf`nrPChBU71U`+ zU#K#e{Z&kLqhT&-rwD$SY9Z-=_N~^3cZ#@|{{_*(>+xVJ==J!2)mqI!3^9eN_lN)e zKJAL??HOYseVsmng()M5(#Df!pdTX(rJOvTMC%n{aP_IxR z<2bkR|4Qm9R4|bA^{>cRm59M5OQ#&4HZI+NWoq2vsE?B)t$`IR zOoiZqeR7J5;$0Bh+H-xq?6Lee3KjL03!>oji;#97_y0Um{1A0s8Q7CrVnRA>M5#7S zI>it@T`!kc+hjti(5pE{Rn=5uW2|c%*msBnzOyTK^WyQrx)e!Vw8g({>#^x<64XAJ z`oS+NAmfj!;9$ATDu_ivL*da%Oo)j|Q4^?g)5cFg$LIIChzwBl2;0R)Wk zK8>%CP*Dm8-ZZ&+9(E^zGhdo;tV08gnRH||6f>YAXMv1!^~TLvcXCS$SYGU(;(aHZ zDAX!jpeaZDOy!U{4-(LMhWs&5I(hB?k-Y5Juap>QjOH_hO`rMqdOPmqm8_W=iP~h& z0tppn>vySPv7J{}SAMZi7AlgJC6HIwo<-i#66k(?);D!IJ_WM1e-88UE%K$eAo(K( zx}Tq(-ma3oJK3MBDgD)2^6=o9?y4ZQ=myvaWbU1xFDF($mHiy{IB%%bhWPxMdr&*|KcnqWfhHnv`#VU-XRG2 zAl!R20*OGg=jBSrZ4Fa8Povl2VuvY{PP41yBaHZx`|<;?+r!><)~(awLd)e=-zj`J zofoO3cK5(>ZETyOfuls7%VMuJ%~3TVIpovW+qbK~U(`EGzH#mEZgDsxJl8Glp?DDQ z?4-o8ZwS|gY!g+54FO7T4aBf-ins@6b?t%qs&hEAG4WSaQcOZZLQGn8Y+_;}Pz^`L zV`3BI;G9#C(Xdcv{aW~y`do$5|M(#dsKY());UX$)*5OaZVzWw)HrI0rkJ3dF7sU* z>vgDbrc?;0-PyE4LX0U4$_v@K8Z~5GKFu2jRI$4&kXUiKzgTBBR9>e<9kH|26q-|3 zoa~eRB`D=(cr#{Mt-zWmd}QS~+R2=<=xYvp#;)C)oz9_u z^WK(L6mSz&o*ENkjw=z)N7=3KMBZ29e=;^GAA*7blHmcD@Es;5CLtEq1H(~8No36> z{Ab2UqNON>9a72*y8F|GP@r_@gRG1_kzn?hnk;%Q7J&O?=J+t6%0iVM1l|DODENnV zy(Phw^ZhIvu(*S)h3yl-4k`g|=i}ek5R-dW!?7*Ucq6XYz~A{pHz36^??PxoFsnzGfLw)d4(o$>T&Ji-^*9mMinaS$@PLK+ZhjAq!W)rP|fOo3d_>(O_C zua(ENyE0!XS2~^D>@E?@7a4trLvITN?gygnO_e;h3J3vL3X8$?GWZ8z_1K*OBA+N4 z37`E)hWAtR?9kH6`gciw0pj|+9$8$_WZ8>FCq@@zx(8M#m(KK{KZ#)h5;ai+7>g$| zgEYTSxtt9gi{mh>!-hz}4>H#o%6Ov$EX(6!OCy?3QUG>nkNe&nalLIXF~7cNdGr>)7H81$=j zC{$amfsvgZ%H^~@JJhx~nyJa*hJ5>hH#ODm!hUCTAwMw7x2Y&RC#kHtI5*^XV_2+n zhre>}RH(~R_52hVq>lba{=2+DR5nI6-4iQW)W^d%xtcY76Le!-`ZN=+SqEm4*S`+x!L})!A|+7oD~%TSyjpMl{fn20j7P8 zhyAYKy@6sOoQyo*a)rmX<7H&8C2h)(pVf~m)@m2Kfa@8y#nqZ`77O$9vU3c&9pN4- z|Jz#p-~PB>%0YdyW$3qG^(o~^r+qQG8fo)I4x8RmAKA)b4g8IFx-Ts~_%jd;70}So z&cmg{!otzd9PFRimS|__=MGg>m7lBZ&(6-<0%vEB#&3|8;{uRek07(N$vYr}3gy$7 zBC}dU+rFx;!`s6YlVX*dU?SdC3}L~d-3fF!FS%X5Jz;pao}CnwlYz&DwcjFJW6G{b z8Pr#xYe}r4KI|k-!fT{=cn|?Hr0pDcR`g6Q=ITzF6B0unUzf%H#g4>a8E0kw%setR zJ~}ogKQ%TvIW{4$rl6vrpfWWvf_R{!0{XQoQzP5Bps8!np#-2!*t&b_)&Ve8we|r;*ZRd-k<7{`ylhX{HQo zxCgcu#Y39@jqA)>ra_h%IFbvM8-K3pp!5!15RCy&x>m)5iz3 zBxm#5ocy@(y5LOjG{)A}UU6Lz%c&zODTpTYE?MmzGS@dmRCi8V+=qv6!Y(J{?I9?t zt22wA_RDi9xX={i$F4e2iDXA{gHpS;;)w9xj0hEpV}?^$ zRgCZ^D+`kwW{qV)XSBEzAa2g86MnE4X}g=db+56iQ`l3iOtZleE0?5mXCy3FzJwMo<=;*6+TH=Gfxu~u#4e4(VY_g&z zvXGKOmD+_>L+L?Osy<(0u)lvGqj2iptV8ZK!PB?Z-AF;UUKewwaLXF3lZpz?LX zfZ+>AkTjZ#73Q3y7(&yfOdI}Osagt{!O8`=Pd`tZb3YQNmT;?9EkKttG2~Xb%Uj#>l(9P$qzC*Trn1=uq#yAP^)6KUB1zwXb9V3!sLy*Jm%6zbaA|EAeg~aPQWxk zKoD&9_rgFwxjer(zCPnE>0{StJ7gTbIlEfPnzMe?ZUQIwx#oe>{6mBD?8fv;2cS^% zdEKm+0T0~aB4qh!bWO~=n!{$c()bp}>sDPw)cE|>+1~$nI~0s)N}4W zMVHc3s^1D)9UVe1 zeB0Z}L7Cs~bI*T$;|_>|NF>fJZl{|=4H%2f>HMBY?!eHrmdB*i;<=TQSZgbN-= z>)Tnk2gOs2x{Y9=ZZb>_fB#EU#Q9fM<>VyQc}K+8mq&xi1-*{kld0vU$dF1ErpiAc zp^%K^4Ad3fjQUTRt0b+U(S!#lU4NHXzX;ZoDu+UWyNt&^SHTi+&P&3*F82r zG1%TdKQRr~tc6VOE4PeZ{oMFA*%ti>0-b>H&kJo)%A-y?w&#ZS?EWyLGO2-D$Kvg> z1--NRUn0BLbyf@W?|D&;pXL~=a(O7SJNX4Z{#4T!l=iat7n_Q>*y2zPX&PGETvq(g zwEp5BqkD}|;v~tiU)R-H}i^t`^irW@usT;%bxKaAh4`a1;*DXo%J?rN{gi=sKlz1ceB z`vOY9ElBxd)<4m=CKmaAtR*1^Qo`5d#>qW9lStS;`MZGmS`+L}AesDvDF*pBfSh!{ zY3UMP$>+$^L{W4I6z9LM zr0dw_T$bw|U&fztth?XKhf z*ft0YKAf&IU4nT{mFV!e-K_V0oxtt^ae%Eeqiu^YSodsq|KRjjIWG$w5fv4Q z*YPTA2@}zY`DIe(3iRhhF7<|FxrQ8;eJgVxm~_3wGZGRYbAJD-A#q1CO|uV14G(yh zlOa}um7qb_Ng@X&&Z0c*s^Z`X_?ddLr;g8r*7to7+BM zVNg2k%pR1xZ2!J!%fG{kd$-(H6AR#h+3)y5g_O@8Aww%Z?gO&n8FO}Xcw}6m?wR%O*OKr_d z#m)=E=>tq$`^rhg*u}-zMFht&UPnavOif)v(l`#M0$P> zP8$$O&TKZ;8N4PMi9fc~R}3*FvOvYAFcd=gGOs8mrlhT+uJHWLw*0S{xbEFQU3C&h zEgDQGf4lFC+c3K`rvIZlQ6*ap3$0Ox7;;=j$DAi-}XF zO1^QK0!14rxry2S*c=|bfies-3=M^!p`R^}NI9U(;LFnW>aSJk>EniFAL~&67yAIg zicuY#9OWP=-COrnTh#RtZ1KVfm&{XbrAXVHi956{GKJ$_tN%*=>zp%;99J^wtq%hK!!;(Gn6QCkv9{ZNg1*KxZpE z58!!)y)dqK;PA_h(8Itfru6xy{mq>nq}$l~y`^f~g`K#+2}4jm+oOx_a&t}pYUD%FdjUqu;85~e3Py|IIqR~a^k@QHNjM>`W5JhNqrx>>C#y&^pNPi z&yUal>kL6%mSOjFc{Tjs%r}ZZZ$aNR=jV@PY0&5lc2OtDXKtWpqj?ZB`qM)4xhlP6 zD#i5DTC4fT!QRZ8TaArQmEJ5OCis#jN^D5-iovD2YInA)d$zxQV&v;m>xevF=lJwD z21*t^~}{7)_H3!Z#qe!A+X$)4PuvK=>3$F7CtB4+mcc#8_DZ#k5d^sX#9 zuR`-BI(-@oC)PV-V<*5!_K%ION287#NEzIktU~R%wAN^{yN7bgyQrEXxJRmv zAAb728A8mMKypj{uAH{O-^JD6;d=wm{ap$C7KK3zxaz@{CTuZzC|ARZXRV3>=ZKq@ zaCV`jG9R3v%%PM<3P(B2moTyu@YHdXw6tHp92t3*Uc>Y>=f68@YvO)fcov!qPSGze zt5+;pqHl;MreWZ&UgG{#4c+Q?Ro+(sT$0vsrBo~zX@QkpQpOQob`GrO2R(t00#XK}^ zq)QsbC$tGABHh!@L#Ed&VAs^2OGrsjYYeVD#|x{p7xp;F!DjhWm0o?3$bU`;(Mr9j zl2vW&MgC8O;3Fi3jU0NU!m;1)uujXzRw;yZDbuIjUdNN(P0X0j9-Mztk(_M-!QJnC5 zA8px=9eQ@CD(H$w5k6ATlG87b_i!+MSZMZuN2Kg-gqmu<*`FyhoVytM8&99e>v2-6 z&=CkW;ygDFP2dSdKoI(ZB_$!NxTn_ea+E44D5#IfKBabZ+Dh(m%jiY8KvsEwTg+99 zQR zlz4Bi-m#o{a!NTWVRcgN-n@xaBRsn?bD`C2p!!4I+4345$>Fcg!7zFQ7HA(MT}h$k zWZ#=hvdu3wj?-F~LI-qZi#-2SaN<8zqKO zRzNQNjU-@CkRp-uE=v5R-+W=%gkK^^JS9B%o*ZZ`+rDw!Ra9uR5}>*>H@p6A*@ONJ z^dECS3w6E7FIeT@E51iA$|}x~61W@87!M8YT^AIzc63z5EwwjSeE;LDW~6i(_-{e0 zed#`a7l{Am-cLVAkl(KkG5%sjV=sFwgi(ZdG9PZbQMD)Q@Twc z$_Bc%E*3c(q23%`^UBYBHv!2Hum3du%C3_JO z0yKlCTa1o08D5)X#z*qk|8a5P5q%|oq*&Elo+{D3cjp1WvE9YiqBeJRu_l+rsyrM< z#kEr)iDIYtc6IA}LkB5ii8Y)1Xh9rZb!}>$v*n?;Vc_Na23L?X$*RVC*W8r@kI6?< zef`RT$P72Y^h10?{7TWv3>qyIB`*~(O5!7mrLmfD4ojl6g>1B>-Q={UrQ-uXevV~G=xk<51A4NcO9=acY$VPcm)e<$(O&$ z!}GFxdv z!ot~A(pIUWLraxwTOw+g$Z~0Xr$?@jH$`6Vj8Ve5(ZSb#f_7NJ(lkiN%+M|qmSq7p z^t9jDBQl0(u4K!`#{>bAXxE!KMp2`U^PQe+*zwJ32YqX8ng6@3BlX?wWyJA+l}xw0PR(E!3|8x0;Nusrq#f2PJg^*cwK zAjm@Nk00YI(FPmP-*cM5%4Hr8I6WVd=PG_?r}7BuGX{SXCpR(4{zyql+1b@4`WO@u z6n6LK;pSoA&B$I_OUnQyC|O`WHANTPB)p%cNM^C>w>UZD>O4P8I@aI34x!d@W^@-aIK{w2PdcGnE@hnxYcVM6oCM|`OVq^a;EV|^{oCpk7)-!U->pjppdelhN!~A$Y6PeM|!hRk4zG$*Me;gUdiGO zGId^#iE$4#RVQ`MN6L@g-99aAzq3GJ!XV2a8iW{(k3&vTPEJpP*H;Zt{QLD@d}B63 zQdU-3c2IJbRkyHCvH0E9nv0T7Ei28pj%gGM6+pc^1eh4c2r z4pKg@1ZbgIf-TS3T0n*zXgOP}$s%yre5Hq5n-KeFYG2n9xgUIp5Nqv+S^*I$$qhrfYnr% zaCEqDQczc0KvY9fOAE~(MvRSREAjd@jk<^k4x58a#&;rQ_(M#>0k`97|GjB?OQ2X6 zKtewR$w zy;b#_mr8CTVsk^b5FFVkt<7mf<6p`BB>{?x!n5q!UirsJ8(^MZa|Jz&jEpoO#3ipVH`915|8OK~9O&5Aj=MR& z@KBL)u~V|qFfej*bF)(OHvAN(+Qbh1qm225HAxx?TNuFbfEO#7eX%=RMzPJjBoMcx zr&@gz+&m+Nri-%s76MNdEF!vyus-MM;JhiJrO`J$r3?-7+Z&9nJ<{Vps^CrNj>XK>@95_CTU!B z;i+{11sRy&TP@alc7a@OF|;2C=2qr^O0se?i%}{%)_?w?{Mgym*;(4B(lSd8>e#WAAZ%j6guK20G;}L95HEQj!t6V!H#82Nlz6cKnAY1xjCI8BAyt> zZim-*ZTpXmP~LsJAMkD!R8v`ez6>=CH%%fb2sVYs{{R`_5=nqB)lmnYk0OX&Ojuf4 zP*74sLs3#kW@@@psRRp~N+z+&^|o2)R<3~;beqoue~y%vmiE?m##V;y&GWn2Bz@S~idNbYbUiK<2*h=zUOuo|89sdC};qFOa#&}4d zu%L;gptSSW)bQdVFSs9g9$cjjSpb+joAKU}zVFQinAntkVw)IM1db^`XwB$+!5iOK z(rDP&*f8H6rIfCr>%-+MkZN2gIAb$lPe>Y33NtQt4nN=BcO zB0zzSYWGPA+c1m5hu_TwsKH%NMw+21@x$qCkg-}U1Q4pXWo~8gC+}}gG1@(S1Ydc2 zJyo|bqKD_>Nm~&eT>HXmuGV$?E-6M7gJiy@;c0dsl@^d(5Y2;@UUtTeWwgzYkHzwO zk4IBSR#a6$LPUG6w?0Mb@OcNdG_*=@quN(YR=5882+)}pA2PA{R{>h5yu9Kx_#;Yq zu!>?_e1cl_7K_z`(nA0FSoucCS5i!$->>S>5K|c| zvIY~E3}Y1$6?APOY>Ngy5a*Lz^?fL}s3B6P)^_)yf`iXf_eG0H4|SgL2F_bl@8tZ} zp>GzYCm|QyL&YMe@lvcU0V7M`szUl>$A;djVu~%>)OtydJycywn6VcjBmy1d?EJ*} zVPtvafEli!_>ijfNWBY{eHCvHB6`8@wU%`>5wT?fn~JpwV666BDp_O2J5%I zPnPDae0A4(BdPz!8kxxF@xW>g(s(tiq|x$^&A=2k(sxq+7E^RQlqUNwEW7qkFY{yM z2f2lkwCM)p{Sy~fsxZQ_iogD4-o^3Nxz+LUxdr9XK#oxvhL%T8NEvp25ESD3OC5~O zRYgT*6+~pDmI{?jHG39)#bi?J^cG+UJxsNWUU&1SO}f1`L5bO6;D(CH?wgq8UGtKT z?oomaf-YDbSAS@}O85G)3k&E^aeXepcIO~7L-02!V4-g12OVuvVtPUxA=pK(_t#Pq zWQjrC-ca-mHWIf(RoN#FHWt<=lF}rQ7Rbvh%eUv6WY`}p;mM}`tj&%sZ2bM{s!UQs zL`ZYEu;MgBKPzugr`~!z;+~qRp`QQZ>|q@_vI2zUouZ(k2K%oY5XPwZq?tAKxln8jKNGp}_%||QLi^hOEGz!x#czOAl;xb$jQwT2x6}&XT`zGG> z`Rl_y?{Fy-AU<#$+!_U=>aCTLs*1S$sNnoE?}&hq-|ydB`a^$&g0ziaf4oqIh1(wK z6hDD{z_Baa>dc%Xk4QdWF}Xx8i&4Oj!bod$UOVV8O(VJYZ6{v?qCur`$O)=MmpxTz z7eI#%9I5JA&A*oZHfz07*?|Y1@)e^Gdpz!e+lxCbg|=e|!5Qn`z>rDV_jh0;mKHur z!1xeple*YqydRPiic7D>?9~5f1(;W7Ku2@(-)y_MoRo+H?w7BsNQh>wqw*7p1tQJ> z({>Mi#%&0nK{)}3Mgd{HsH)==<&oC`7QL}sP0R;5zS*ZP;dj1$>3)lq9-Ayfy57MD z?fOjRI2x8?`bfwCF`L^MpVY+!ZWV~#peQh-tQNd0}SZG=t}ivoNBA7EQI8# zs#N0t_R%d7kytCsRQ2pmLTCw-cXq(7WfQvRhMvysad0BTeL=$Ka6Fl1`r(it+3WVh zH3bVBMaoxt#$3ga?NS+2PG`a|7-E{i)j4-N=RlZ>$&lT*UlirKHH&2*o>q2L_fB+J z+EqaxsFfuRq@8~q&H;?tVzbAq`A^ zSg)?GLU39c8w*bQ!m!wnrV}{2&vDD`-N;@%uuAzn9*licuP8{42+mP~Tg%=DhNUta zZr6J`5%am-ckd$)H}PE?O6c{`q8eoM7LroLn<5Z3ahpNiVcX?9;@9eMtPT{@q z{#uFl{8rspCG9*PhhObS8)LfEG-YC1zDOrXwJEIh+Zt&d=369be9C}wUw&B10m40E zu3DSh`W#4ZI1x*&Zn{o{BfE(xl50IzeZA}KPJaj}5>9{%us`Gks4Hwf7NgONNr2i$ z>&5A3J9{F8hH&w|ewv?;JFP>6^+>oEytn8Cytc64#unA@zqlOi6p4MXS#?A(QAf=zYPry zvV>Z$8c&@cwjxqecKz3G0p;?OQ+MoZ!@vut@|vn@W{!$dW{%NuMPRvBQBj)m^ZgGn zzw^BdaP&y9zm#DH5gwY7hsYTHJpTOFfv)xDXPdzMYN=G-?~vqx`heWx%={|o=}1|O zDT79x@l-Q~X~~ku*=mu^*B@Ioe`;gT3g_F&QF31GBC2YjSnOPlRm`cuWcZSNbf3;g zFU)zF!u)XQF$jR&;+G@auw${6?5Z84zz|cgaIRaRh7dzI{JC#=ZyS+KN**WB`HbGIWd*#dI#Dn zY$Pyu+H{X8Y+{8b$xGXCqkok9$A%TAMwchYd*>(Bso({sA&5#RHW=JjgCjw!W&2@z z&G&F>IjHuk)6d9#?;W&Fk9lTqEaW2HVzksY<=PJMh43> zBHT?l_A3|8qVe~XzNSd)~4-@pv z`svaFB~N>Cgs3l(9xtzf+3v?-8t?n}u3yggw!y%@A582!=llETJLToX)WkH! zhDYRqGz<)U)zw8*5JEJb3y+PJa{NI%FjH_xWT{WKMm#V=1@#ul4Sgwsqk@CuAVVyK zy=(0u76!cKtRNAYt;?vekN}E7_anCtNb-vs&FU zx7D2g?{DfLG8sB%*9E&pOPX0?n#9LHrh*_>+fmg-)YTlcW3&b%dk-_cAJUt2`Da9lyCDuS$$Y(z9XG?*6zP+*c{cvQVZzf-pn$#TI5StYhm6d{*nApln zMn>CX8edua<(p}FRfPbt#qv+jrbUDl1>f%4wi9Sy|8=-ZA)|e|u)g+8jCx_MsyI3_ zI{uIKQ_aC_)8UaBYC_RMJ%G4{PFaJq{p6nTEx|nnK!dY_z4Z6kcYCgwA;vbr&He&i z8`Ft@sGylO^tsx2vY>GF?5wjtZDoNKVVo70M~D~um7kU#eDG`n=+LjeEW`f<9cH#Y z|2iVKV6#~Ju;isCySLbAetgGS0cX%?Hae&b1{gLHcFT!c+pNH|-3@TDNof*_{BWUN zI5Z?39u@|2z{AcR9IEs`#KcEbgOh^xRla~UI)!;*B*(j7AKz;{{cUb-P)qNs7fPz* zpFY==RUOWFO(#mQ;@QkYS~u>zoYHwNk4{h@aB)&%0kR?~PV?J0VZ+jCFvt2)F2c)F z(~$C#;~y5!2-vkqAKnr!Z~$|+7WbN~$*OBN2#Q-ydJ^Bq#ib=Dqn*9K1=#_9!(?p& z&vo7T8{IBvPybcia==Jt8X$Ak+Q<>_XX~svG0zKUP7~-gKf3{;H$?y%0hit0^a{f5 z7tZOK*;&Vm!^tib{MoO%OC!^r;L{`$p3uK;FsGFSTk?^Ch6d0sE{Gur*N!Kz zXji1ZNVUu?%+0qjvfkzSaaFqwQ7fFQJ#S6=%W=SSakX_xN&1nNkA{IL-BN%ymu31W zjo=}jzIW)!I`rar+{}K-avo+s2Isv=+=a{9?lz zeae%oi;E+ggH`Zub%dy3I<*FC#U0czt=i+Ge;``Tw>=AJJg9R_vBgC|2TC-jLhmhp zsyNlMaKruHe6*`idc{Xf&@bW0IA*9+HOH45&bb<8CmujuLma*aL3Aslj&=ru?(SOB z_R7xR#KnL7Y*{kZO^-ZWYQ8vgez=>75yLo`Z+7T7zljSq1#+JayY*gxhjg-;Yc%WV zKHr@x)~K^wX#`pzxg-|D?ratcB#f=yy@?7Z8~DM3CAX%gy2h;ij*+2>L3T-2W^Qg~ zaRJ(JZ4^|0KlUTfaC}r$oSLG-zcDuUn$kUkCAa0H;EH%~Y939*X+9Yk)`&3gcxm}4 z85oFVt4WmzmLEmg_YhTKMDFC%FslPNE^q37{hR;&i9*i2rwcq4Wd){4a>LHE>|`87 zvjpR;l@QP_UMAHuZINq*9WFXIyI!0DNVbzr!@>)@X8V=)?HK9^VorO#r8I4BC(DIO z&;8kdbU?#j{(Z%#uEG?S$mMe4cMJrWAK2`!N`Z9xVt=M%baAn)Axp@V2vrHFuB^0) z0Vov2wgtC5Y!c*}N(}%$0RV%8V7@JUjakmi56td&gZ=}PmYmKz?GBfDB~5%cNC7>a zlzGNjD6jn74Y2&XX=!?371t&K)eWhdN0uiKV3`3wzKr!Bhchi~p3|8mA|4RGoSUbQ zH+=M+2x++Oxo*odZm-t8yOWtUvCG5yhJ||D`<)HIC`;wDz1vz50y@3LDv#Zk6!t>R z3cG87vBP6bWVHZ#{}^f+{J=h!tq}oVq>IDx1`zco3%E%aj@sajCF2tjZCm^WA;xz_ zjse>{&d0Hdh?BgU;EsWy!=~x5%V~5M>xEl5TfW;`1}VNwZ#)CZ>921;#Qlm-5+cRL zQ3?soPwm64`fkHfb2eicnD^mn%Xp<%GAz2MMQ7817MZ3m_cp_n7Uyrl>I^3x!WJhb z&GX^e2i&*s@s}SrDoQSqOF(C_$^Bs+pu1XO9N^z};QBvKtqooknlGGq?qQ)(e}4ze zrWv#wzdxj^gK7VZJ)RHKE}cjEkHd@VUma!~%pS8EG=Ck4Du51(rn0aAVvdl)R{_PB zZC@2y1qC%&%1|}2un_hRWGzYH+_$N>B&3;qkuRFz$?Av6>K2oQE^sd<&*7@!#i@UP zfu0DgT&HrgC0IR!-N+^o5g#sj9g}u+gBGT1Le}1er%s?SkxTwyPu%h64W#Bx!>Jw1diO1 zj9w@3NlKamH(J5tt!jGYW?_JBlIi65>8_fQRZ10jrMT^^xsZ)(uxX5q8H$y;ELOO= z9h+o81P+o1!~W4FnWx_ z0g`5JhrN--dMhG2DOOe`3JM_)UTt1pVi`6U+wbG8e%9s&4-&`A=BTw$A6{lq4agv% z((Oj@-k?M9!LW65-ansUm)&Ne?$G&qreBKVU>+!9+ty5nb(=jdvD7r(AELZ3yk5d} z??`FV066y#KAVqew8Tl&0FO`_wVM^u_%&|s=}T$2617w$F{fRS2wa9}vY0Y!UnK}8 zg-6XuY9E1ykrJ_mrm3IyAx4Wj%;^J%N$h=)z7R6T))K~Oom%8UFHeWjTs;83;BIaP z!H|$%4fpa{6!Zxw2LH-veMEuwwaDo3X<3m0)g?tq#+ZiEQaL33xzKy9ro5q`#0nz^ z)x{et%D~9Dcr~3m&)tKpyx}OFCYRF#iubY}MP?~9(5EL)uJa6n4Sv5R=75&DG<%gG zL5G!N6IMqryrY{MoUE2Ywi>OqWw?ezBg4akLqcBp2AT?+8l_R!*M~Vd60R|W&4bLh zjptI-{$LVkbS7YAW~_a1q7!pm9eGq;NkmmrQA_#Tk(Z$h(UcR}>sNsLFhKiXenElx zcY;Jsrvt0Qy-l1itkx@I#svOd+!r5sJafz6rn3oEh_IPeUnyIpEs!R++*4aVTrRD8 zU3q{ICWR{bf1#$ZaaOf7>ac3EC`1=H_0>ATmiuY9O09E1Q|U=e&ePuKyxiK%+u&rm zRBk3TTHoHd$L7p{HtI6!bN$-3jAgW!8=LFa)vZp>PH54Ep5AJ$ig_JqdiEBJED~T) zF2|2CRuCod?Fe~zfHI4iL1t*O-wqsRk3<7=wazH6d5HdiFOHSM=71hPSjgpY$T8o? z{h$40w509^VwDaM*MZPFn`w(uRP1CgglDlO@KXIR_&?*7!z*3R#DShetV0BJ37s zX69y-QcyCI_fAdh-R-Zg_|h|Dv24x7#wy4wjI*1~jZRtz`3`(c&rnCj&CA8JT&y#F zTv3A4mbA*8u8Fm7avbupDCkwK+%@FQK0a{Yl{A|_E#~-=`r|>qzc-zqhEqq`EtvKm zwBL){t<7#o;bB3CRb%7gKA29nJ6Z$F@{sP=H)ug3qP=I;gud3%IfcM;eJa{z*x}WmqHXYD7nc#ks#p=_oJo;L*z- z_8-JYMbiju)nx@_u`*{`C+aO)GAVl8WRkE5QfkS$ZM2WmI;bV(pmoms-3wxJIsj9* zb3W&UnLbonM+H5Oyt&=F({=ZM?7Nf}5fM30_!GfjTbYxNZs++?YNhjWy9>k+J{aN@F+44=tE;P~hBvNGtjmXrdY5A#@Ykd^Z557(`4&4NI!eu3UWwQ6?;Gvg zaJ%!g_w1$uCm~^X06ap><5_<)mNPJAz33G*efQ>G_-Nwpnl%u{_H2PUDFqi6PVE7_ zKnnMV`ER&bovG|i3JSjQMlZ3UA8g@bveW5HXu#^jd)d-?0F|L? z?($%v<#B6fK+Og#5jZNu-!AUtLb9B5?Q?(s{%x*$L&MdwIdaXHCt6;B;sQS@FIRj6 zt+Af@R%va;SLk1)k(6BinI=jE9#l%uCZJ?K;$qLhHRt1GJp}{CvQ!~cVutsGxw*5F z0+MG;Ijk5==^3xy%SnLd1nr;7$xoF#V}B2iSgiSCgvi$tNT(Y0dzzz#a!eVuK>xQb z1_WleIG^Xs3B^9t_X<(_&+-vh1je6_@VZ1d3mX# zbF75nD`-&L_Y!K%!+x+*+<+zMYbY=Ysi?#mcfNeA&ap}zf1OW3{#Fr$lSziqf;mpE z756#8%GMsv7l>o~D$t*Y&s}_=WhnWg>9R4oe=Gm*uDbqa!7ZB8=U9sg>NTg=kl&*7 zv?g0r9Y(K7x_MZs!GC3=uK(mw)jwBW8D-Bs-99Og=_zwsL>9qMVYmK|ws#0f(6#H0 z6jon|&j!TM3d6sCLp|+WB=wlhOX zR?`YnrX(gVuEA700m@^$#~fCDxi{O4Q{um|mTmQIR;T=nt*5*DUh4OZQ~N#W%7P1d zBR4l!*y_m48zw8K1IzJD;u#cH7IuTJ!lIna%;MbHg1GX+|M-WOlmglYB6*&|@WU$K zm8wtGT3s$8h<$NELi8V!)rya5vVMBn$hfq+9~<3JWI5eN=i?m*2R3@Mmd7K2QHx|- zzDpwb4mp~~PkQ_(_)W>H_UYj9s%h>y<$uowIrMKL#~7BzMxwXs=s4{vIQ?<#9&O}u zK+UFtDdy7%+1vr7wdYX0!O+MQVr*gwSLRZui^MN&T{C^QpCc&9h@+RGeG)kBtoGuo zebvo;!Y-?UaMdE9{>}Ek0?-H-7tK!@64W1=-m`~FiVx5fR4OWrkFb^Rjaaqf<2gNU zS8Os!$_~txdN}osom&@z=r0$~L5#gJO`{`xN zW2E>0{bF`F{>pMe23hf-fb=JWZ^@-AX5Z|b8ND7w%03l2BZ=ZeYM zNBlO6#Dy%EvU=FF(}pj%#bd;L0?S6qLZyr7>>qnOI)m@Z%nXfkvPQR8RsDsDh5Hus zE2tN{AIgt3D}Djw@~=GA%-~EARHYc5AE` znjwdy6$wFu*|;bC8LX!RQ|GrzTu)yP8|wXMC~%CoN>`VVaRF;*ntw{c*jg_)$$v97 zZtyqXW&`Ml*^;)+g1`<;-PuLX6&NUs@!BWA)Fx6Q5w`XoGc9nnkG-8W6o$EBCP6jF zwpAFgRrvcOH4P&b`N!TRgY7{CvRR;fdusr)%TD^uHAGdd<{S>#TRjUkTf^!?6~|6F z_UD@(e{8EKnu0QYeP$e9ve@{N#s1+ab5r(Pk;gs~6O^El{p|JUeiN{r&=xF}kmR1y z;X+9kf#RHmN4EjRLZ6;%t+JGN8Op(84-?mXzUYEAz)is=hskUDZb8XT>T6%)(Ik}Nx5?4huJNjs1)KrYBo@djb@*xg6)|K_2V+x43#*LTNP z-v>n49iv5rX#Z-Yb=nVD)ee+RrRUamx$cJEMy9v8U*8PPao8-DF5f-y3c)pYXC3@4 zr`k42Zc+YA{a<0Lfj$nHcrAZLok{IIFZ_6T)^e;GaaCRZ4^!VAPUZjqUx_jzD`aIv zQK%DfjuEoTsH|)$$R&yrKQ6^(B1fEc70PT%k4Q7IcLZ8x4n=Jl2cdOE@nuNM9Fg0KSr5 z&ViCi}aVero;~_w}E@ z7Ts3me0Mf}juw81Plx*qZ^bMMh!N%{As9#2dq+u8d~WnsjP zrR%*LnJn%Yvc5uOA`(>7Cj8!NIOnYu$YfhivO>8wxMWi$X)e6(9Jq=7q3} z44IE*IA~93(wU0$o@xyTvH#|h_B_~p3s9w@*^n2NNTz1<-4{;qV{x z>Ag)BQPU@@5v?PR$&p1DqhYz36u;1XCiu8Ob}G5_CcC2_Z5$L(K#kH9)%OJm9IM_3 zSESr2kTa4DqiZ#BQtoNDZ#(E=btIGR_V>ZIDa}-|#^KlNFaRJz+FiR=CLxq->B&Vq zYl|qev~?>Zqx<(c$04JW5VLa+{=A+|9la4FYI3aEtkk^_MWs{ z^Q4Pnw!hxSSD5-77&3ZK9PRy?KQwyWOt#puP3rJ;u^}0Ar!G!!cKMwv>erY$?qK_M zaEWmG;)l%u(EZ&2WzZjFFHsIOZoa7iX`yuTe8kn!z1ZsU6=J>2VjnLWiS z=W86hR!r^?w{2~Er7rYJVLip(BeE&TNYXLgY>q)Ep?m@Za^@9U#soG@3JU{!11ql> z>y*8`#qibUN)QtZ3q5muoVH!RAz^5=>5Fz@ByL6sIk$1Bx;i;vQOEw;Lm{?2z8 z?_b9k9@a(aqjzrTlKmK|-;(Ovb^N>SrVJjE(l+9GAj~a=6%f<~sSHg@tVu9S?qh85 zTO8TG>x^VvWGL*B1PecoUmhC1@sJ*&*oZn)B*ed7jhE3;rM-k*>3LJetSmrC%@@1k zu4mhidlSa{G4?Fg+NOjba&wK6>UHQn)%Lb~KiY(F&llJLD9vuZI=jNnbO9kMjwXH^ zJm)#$m@aoo7Bi`yirDYotF~YMlMeYYQ$mTN_f5aBYL&k~LsqkSD|BOP2kVBp{4i~&Im80_+y7#O zh`Vr}PxZxd1Feu^_yn5G;-s%^-CXKyyYwwS%CpTD_{^~9!s3!?&(VZd-@IHi)vu#U z_Y(_;UmUo)@R6a5x*U^zmKWUk&8l~lS=l?v^vnG?;obPp+dc9|ks1}g&5(D14Xmc#`Q5DAxvMIK`=a%DMPWLwY9e)F(3x~F_Fx}{{Cmo<{?JTA z`tQO2ecT-GBs;#lP9*i3P5Wsm7bmo?q&xq*IS}q%tFbV#urL+D6(bLT}J(RQ*cpn#h^RjNO=M$u2kX4F=p56s;_r8znz~7^O8Z$dJ!@_ido|%Q2 zS+T`HUP+^?q*g<}S{|IxLj@aARm0+}r;AZzA-QP-e`h;B`N`Ji#!l{yJ+7X6Pz`J2 z%=Y*z=MVh;D?J(+$XbL{4(@Q}U|K3_!%CyP@D%j^Bb5gz>dM&h#&>qdm?>ub_}^*} zOLp;YXnl7#fpNCC<@-DSkUc>JlEO;dxOubbVcIST{xC4mRQSC2lTF`fW9=UX^S$jm zAbCq44gN$dcYBf6K%}^MSD0DqTazMZmG&OSY!SKr1IrFYcbmBp7cS)B$4x)-W8_W< zm!)4z*Cj4Ma5R-S9NI+ZiMD?Q!wj$L$ojN#umuS!vOaFl9 z_56}lI{=4zEVfi7-GiZJS)Vo7l?WFx54`PWdoH#GoQh?osvNK5A}Y-{KO%f>gEKT` zCDY=-f=iHi(JOJ&vA39LE+{(jj2^?1on_5zH-`V)U0f1|(NFjO(_=;yZbAI3IsJd% zEo5#c{vjQtDxv2x7kI~q=Q1}%J~v(wx^@r+1BE1g8%j}+wcF!V=H_Duq@v#AL=h`A zJIU@@l&#oHc!d9&x{|zM9(WB|5*5Ni&r-h*Q~NHI^Nf|1J*5m^#{N`pK<3JGxG7=l z)j1>AC6s4o=~7=#7|v_em-XF5ov(YVR2I(Vo-Q>!At%*)+w%C4y~S~Ry9wMU@JF5Q z1u8+Hl{2k;(5^%T?*<>zak#R;$=(!bf&So_e>@U{!0T}mYF5b7Nanahl5QNPG}E~e zZ{J20&?upZehgkLiSEHcL9Cv>zHZzbCisj+tv0;>&>96vdf*O5JN3={ript8{?f?7l?c0Afq@Q2|DZK< z9~GisCB8{=6;?II)^&;xx1b0rbogp*}sVFITq{?28@p%{| zNcf<9)5yYSsSTD$vooqFZn{CBpa4%=jX4uzYfaAPJT<3;7Wf>`5|z#WX?FJbb}(FI zeOJCbGBMsbY-_l?R2lT6WWavtibfb56b7)-I@+L}Os#wmMp;B!UysN#i5$YK`KMZcri~aLkRf^?HabW(qwO z>K^_<*6VR?9qxXpL>i4;va>`sS0U2u7N_#X#F@##F75X=3G^+^KTf+)ojn_-s`}%* zaM?g#_rUFEw!JXH_M(+ zlywyqugJ$1zZS+&4LV*Mud{4jsrCBJePS_!mh|2wtuuzgMBf2q^SG-$^7gwiwfTPyOUZUTR^S=Go8wG=k#M4D-$%qP z)l<;mg;}vf_;uMx%SdqB@^>x7v)FKsCQo$X?&d(G15x|{y z(W$e;<&l?-b>!o+>(X2?9}u#3bH7;5Ux-hL)pz)mmx+7t_`IiJvEkv2z#sC~4x@yU zn}YRDCOv;NjKV4$CaS1=*eD1p_qEclp?szqv(v5TDn!d}H(mJ$k{`Vgzl&aJcZINZ zI)c#c3$b}crN00c>km^pSCW&BLsg_DY1sKz7UFKuRJc%q7n)iGX?t4`xfx@s`qhTs z`FM|+i#?|aS+A>!=N8^=oti4zC@HSaMnluV!IY=lW3hZ0<;J&2<0Px+S+dkOyx8S8 zfK<#xcb@K2M&?xdc1^5*djO`#hljr6n#AXK(UqS)w_l~ex7VsS$>G|~DL~+zgep!z z)Eh4bt+KA0y;Ue_nx1QbUEQCy-I5*-rclekHxF^m+Ehe6p|0o!pz zB+Z%<^NO2;2zG9&`62WqlXv=G`&@QTUHy7~^%mEy7kOR}I!2X#=;z(L-_-%P3qLk0 zJ?TNTN4fG4y(ceSvuoCT{A(=| zb8*$1;~u@inN0_&OX6(Lg!Mn(fhE+-(KD$4Bs<|}=Gdj?P{7zS6DFj(!7;>bfJS9~ zpz=Zs-*cHn2l%MP zU-Pu%!>_A8zX}uLz>n3kyAx@b^9kk8EGd7(%E9i!>i9kNa*y59cQ5n*VoK1}>ASTZ zc^x%0a*hl6A}__vX?K)7{L$O%Abvx<1g`SfTO2?Pcyx^)o|#NtxI3Stoh?*w@c2+E zpL>3h_|B=|cjJG};zHqrL+qTVYk{(p0M_>&$@|PWG&R1b0CvAJ|H{4>O$O05$oH3D zPmy@#W*VPd_k8c>UG!PLWcD9@C@tvJc=9lnB6jX$>{g2uVG<%3CSB^8&ws1+q{9EbEX;UkbFJD7NkLjl26|+6oMgO8v_f^{T|KiN>m^ zVpn^~|G=U$RUg|3c=ZOPrpK!9&!4pkpg0_iAsIg^aU0aU(s;$N`hoy~tq5Oh<;<%{ z3{8H|BhP` zbkQ@*9yzkZDfaYZe9G?xHu@VqH}IA-#4auMrg-}y${%p2s4?{bn`@JKQKTD4eESy> z2oucql8^Qt?RQj(-12L+`H$Cqo8y@VRsG?cz|X705VwrC)9T7HVRkgR50x$?EaSSh z));q~=Sj?Lsosd z8h5o93mdw*z4#;yuG6U8VM5*%qEF=!$jh8w`iAPSS5VKuST35o6#Z}FQo_+Lb{J62 zj62Mc9vcCt@GH=wSV03i`1OTMLJ&}C7jaVZOtEDY-gtew5P|Hpj>jm|EP zG9Dj>X`hrkQ&Myfe;;M)WfQ`^YgA(9-ZH*|!`ZU4R?H98PF&hwci=kG4p3A;D_>gV zU`ZDPu|gj|<^0gk`h;#WX7BOf>-Hczloa`FN&33TVvc@}Etu^=L)e1fF=7A4!iCkI z-&h;4dl8KPZZ^HiAMGY8UCGm+uJruR^2GdaP7icXjC*W{_30>}-?{~V288Af$RxET z>Le0V1AuWr^$*9KQo9d4F2Ll%pq%-dGQ~8ljOrhH3!Qb7$%T~<&rP~_U@=%0x zCETb+)TK*eSFAi)yV(qg$1jkmhNeN?3((X#n95Im+1^ckPUIS*G!EHB*a%J3C`&2fC79GUK#fA`;pzZN^2oiC1 z4V49IkcGk{MOCbH<-eQF_jg}23N|9sQGavemkZB1J|DbK{Cg1p9#B7-f0qCFf>6nm zWR1xhL=ZG8YeDi3&$BbL(kln4VV=9){(%0mL^?JEEa#~|9#$S;ds2P_YHn6|bxLr5 z&%?{}{OXdV=PXF9qd2!PQEygnD&w_v$;jgPS|}?~7#JQ3<($na;0KCQ5#C+m83NcG zuBs461sFAZyDz`FBuA_>v!e?qX0K{1W_6vVi+(2#j>%EexBG7eM2+g6y9kU^Dh_xc zuqrFV_`j3>0hOsZ4g(_Q4a;iHUI6w;?!VXa!e{0AgZDg0GYTZ%qB_aD$ZBHTlf=P& z8|{j;1>&kACfAbqwM`+S*pc#WJxl(=+V$ zVuM?#Px8oHP<|Wm%o;FRrigS(ot*mhYldCyGB_!Y}@AFx|0yQ4Z_Fe7$f{6ymdJ7V#jF*XiIl;O`|2OgYfp{HkHnk4Qw$J?8JwXt~kkaBOp(*{gS zbX?-DO<&cxOvmfu$t(n~U6a0fv4^byyg&K{aGP=SMLS1Au_e*eThnFM{n@kOXLpI; zH(4BH{~l1+_v?!s4tXKI{R6%3>zLTtm}xu9pqk~G6^TSG=L_vJ?yhwwf5C}3p{{fk z8CKSH_I!78o*iOb%7=L!rk?AJggAjaN|sOZ=?K#r%vHo3oQF^^4>`vbIzO5Va!bnH zt*bc`0J@&S3Pybsdkt$fo|AVF+^gx^Fc|(6j_qG1LLbD_$oz;w;)mHn~ zKYB|X*DGbYc<{zxNT3ULze+=*Imeo3i&jSqgr7D;rC-91N3!E23e1dRLP#~9{V#q# zAU~tqh6;)QB$l!H@pXZSrX{B`ACj*1jINK@?}eTZx%t-vV@vsf(>)OWf<#{Y{}tav*g0Ppip2Au#t7EmcUN^Q>6r#{JEr8{EL=UmRTA|S?%w*U!S^EVh zKW=VOj#)}<%T+?aAHLO5aE?c@5=vMJe(Zow9K-Zw_oH6yg*&hTFlT8DmRJ_@Sf;jA zS8Aq`rj{33PGHmg&k!)v43}CEQZ7>Q)08L+cCclVYAp8h<+HE~XzRAv>>!YByuXoc zE7o18O_#=g2NCq|9Q}A?;@9za%9Ju!4Q*2tIjOEtp4=!gJ|ydRffSJr(Jf8jZHeX6 z*VzXPjZ)I%q1W2wAdI*4L=8s$RwiaBA|ogM@H{jo7>hyQC0eK}zTwQmu)tOXrngP1 zQQ75RYAQ2M$jNb^{}bJ7a1XeU#xm>^>-ZoDoOmDaL$XuZ0Pqb~x~tUHf;CM@h%2$X zEc}g;#oUfiMcuncDz^OOqzMAl_P*opvxrW3?#!bb+x<7Ap$89%|K_@Bor-?k;le@e zmUiqboFPCGJYAKsEx+L1;k|~VG4&|omokrG8Yn)IA5IU!t7h`r1b3dLrCHnF*-8C+ zH^>4x6O5~?we215=o{)jZ-lnLeqG$4SYViHhW`8oAj#9#=`UOO>6m~=xD(adP-Kvz zO<-^{9%HP~R1?Ji4RKwDF;PXq&FaQ{l(hTV3+2Owa3V;yTQB;9?%b?M7lW75cW-+m zk1r~ndX2xqa5UG8UbY%U32Yt16ikhKj1}qlVH*E>pD#YX4UbXR;TLH<8~6gP<>viB ze1QIi^cgyim-~Fqtd!v}U{YwHZLE{xo08JN)5bc7&p@2fD{kIk>lhg;{)v_AcKJAi}Dt~#ULK5{Zou3CY~HURj1`pjsa*Q*sv>Qz?Q3j zy;Umh4srMnv1ndin~dzh`}jR0Ykszr6w8+}%J#Nt38-L(JIn8LVuO!V&z;jHH+V+r z97vQ?N6VfB8HLW21}=EbB)Gs~C2d@`?qs~h)oWOryZogpuvz7mtKdJ-n}LcHG7xrl zh^uKujILA^1YH&pQ)O)3A!)2DnYfz&-x=fXW;X>?F>z~dIti<&K zhuyUAe)lFzC+FXvFF7{|Z!)q7Hp(zZ@%o>ldFnd;g$&N2<&yPgq9A1Rygp4q&@VKp z_gMX=RV$6p$5{R_uV2Rh*9lyIB{#agpa1TvMV<|sfl043L8Yl>$I{)UC15#aaH_v5 zjI+dN_WbzJcyX;e;|3h$@!&z(J0;?7_ zKR0QMR$Vu)x=2^*issrE+|`tK6vn$@>=OkVVm0%THjk7#bS7Lr2Q{bP}ugFd<$U zWSJvz?w?!;JHb~ND%7~r#*dD)v!)tdt#oK8sqP!TE3qT*)An~Wt?(tw$sVcx+W<6M znh9?qq|cuYsTSl!rN`pHA$qm$NKCt4T%z{~N~Z;YA#?xgqkyM#(o&elWP6A{MGcRT zb@kmkn};Y>iL)ebev~QM0(yJ?7R>&@b#`Z;*>`yz{ki9%ME>i>G3U>8!Svk^m~UB^ zq>E(JpFu8;`BJQzf-(8T+99*JXpQ%2i7)Eo?2xTW}o>5UtD8l>l}j&SI3Jnx4ZYw zu0&mv^Z9eF28kzmuTJG^$#JM{L{h^EoyR4|@AX9sM5~nFR0G=t(r@>KJpWf@y?fLL z)du85mCyd%wynO1yiETvf;sz#x!{sm3GC&zI;1I4PW|HjDa&6Q37^7Q_nNJf@p8R^6}dzXgpFMg zSr^=fh~B~}``dq52K&j)YfnOGR< z8D{@BOA-Es5K{@^Mh1L1q1059^Qkhmhvt@Ees)KUU8XqFE)Z&Szm(O=YTolfIh{mzRo(Up}MjZf#_uYpS5b zTAU1m)y&skt9}>GUA&m&#{G+Q`o6^wN-OQ=bxC*R>-7i-<;b%EUlrEN%7;6?w|ALU z`!=^+H>!}2Ao>Qw*_!&PjRSiN;zh9A%6K)1h1}#GrrF==k~?=1P4!P-ZIjdTSN3lu z#%9@eWTJU^`QBz5I3kt&Mj99d1h1=^29r|XK=CT18vFfY2%X#f zZPRz*O1CBlKBS!c+S>Z&Ld$qs{f+$-TgT-p3>TEMUjI|>mCY%%12X=F5Nyo;N0dvt zA;8{PD<}`szlV6R4BA}K$i=#h2USDi0~cnA1^(CKm~$#+Zl3%CecQe4t`OL=db8i0oEZnhygJ1OeI*~4il~PscIVr`BG}6`B z)6@QqxkRg)N{lcH40)y;lq1P^T zzRTa0QW=9u5pGSiTz3XMh&xYgilF#6lw)vC8|eL8VG3kO*ULX`C*)?K_otdYMp;7u zo=eAm>K7~qaJGmVeA%0vx~MEqTU~4GUwTfzuJH&RWb2o`c6Se)HDph6D`mG^eOZJ5 z5l9&?T~p(ID5wRsyvH;hD22y^)ZbzuV7_y8khcJscuII9a#dK$eXXr{=96_c=&|MK zuBIJdj?Rn*L|_!YBq`_dXS%cXPc~t~_w@fNLFdEBquL{$nGOxKUg0Ln4w@*++w5(P z=8A3H(fFMGe_oUtD;(Ry7Em7UM&Ls9e6lERnr4@o!t($-uI)!T`X^# zjLnOd?-W4EG0R+IUtE`;^cF;Zs!A>vDe25lc*Ar|BK>lHN#r)|4=%W8Dl6-Il2SLI z+~m)>GHw~q4oN{GWdUQmc{K&ZGVOpqOJx)f=~uqJ8Xeduk-6z?1!+ODUUelKyqTLW z8w&>~42UYx>9RgY)1B4P+Z?if`vas0DgSZt$+&U3;khm?ZDkl|Po^c(f^4}dEO_QHL=d|&%*;b|n% z9O*b(;(~g=X`xQsK*SWE>w*UzN52HjADkr}EbWCS7LM2b4J7T4br~YKBmVoQO7pjS zll#nKE-^?C2^7NWcnmpA8L-iIsLs?bpg_!{`KeWA)dN&g>!EPBmbi@jLPERmcv@Qg znhbLYY@X)jQep3i%l(uCMB14^kan5pDvyYO5V&Y~1bAsWb^PAJ2gk$e^dp=N1Z>5~ zCw-(FQI@TZ-^)W1D;)1k_D#mHS=g|yJ83?b zi;8_pXwpFQ;j>3&IuzU}@t7zW2p3N1`0Z}}T9mWvp5`V}|9Lp%RFK~JADiC!@Z7`UTfP&E6u&6vbHG!N-Em|C$OvNn#S#`FWCMySOb*xz=x})nG*0k!H z$5nTrfeBrwp(bDCc$tTgMm5X4X@0st)f`N_FnFdQ=S!)0kDhJusDV>UO-XrnZF3XME#3m6+#Hh4k(>Xj zJ@a{nH!*SA4s|{iJUsxBq{9 zzAnB`^g|WUwlA{)4jAq?K1motPE`N+;u8FX2wZHb%1$i<9&*L-9b(g~gH$`oY(v^Z z9qPFmFI?MNvIXK*Ko-SrEUVVjXe_I>T%OtQsJF_g;R+A%h^9jk-H1;k0C41yi4G8ZY^YVvP{NWB6 z=9Q=#7a}YpJ>+`|Wg%)->)Dx!nB3!Q+C+;WZ&RTEL*Hz2%r0X%u{LMi>xd0|;(4}m zeqmk^_h>y3dnRa`01FsH4KkfajbDXUk)hpzhInof@Sm}k#9tle>^N|X@vXJEX4I$C zjcQj(qN3SRo}?4i1rl$AN1o>=FwgRTyL;pw=t?%t$n+*AR$s6Gc`y2G)8<)sS68mp zX=M8tp|zEp=pNh|VWm*cB44rjy??$^Ca%hLoN_rf1iZQMP(j|8uibkhm?d>n$gI|v z4C`}av5B$328_Z z`Ak(2&=qmkgU$iy$Y-*X;KD{^eZKFRfaPfSlFsgAa$>Mwf7a0fusD7GywK;EiP^4x zE{O#U*`I`*`bsb2Kt8Z}8duTC^M}IO-&sLT=y;D2$=rNinSD>wu=ElS7m0&j7GdY9 z+TC};j9awun36PZiM;rfFwpe%fr^Qeyr%NKM>HeZM_UW}WKVhwst;fCD27bCp#@WC z)JW3T-6>XF(-?2x_B{q{wIAu9fCeui6)&_8ETdePTMl)cw1Vcn!Da#B!NQ3<*x<&U zW|gw}1KOUw8I}J|PQAika;WM;lVmh3865bm-u=&R4;d)U+boI6Nn)gWNm`=LWiKAV zh%&~vkj5kFSeLm>%u^>I;%pCv(?a2yR+_TKr&%BR4K>tE!TJ$nox7^4FVhS68j>~8 zoGJcb_YwPz7h9|<+3S;#%u851KtZ8-OX7kUvJ4C4Z_jzRE z+hUSB1p%n{L(s%lP=>rHh&on9k%>*RC3%}@_}*i_`sdnyzQ+@ej>`fNKBIV-_E712_ zqLoyd%>m#|<&KV4E70WIA1S|~6CWS{Htswl^67}#mC21j$tc_^nr z6E)U7dwk(=M=s_AyTyMaTIVCu>SlcgVvvVfn@w$QgeKJ>8eUsCh>;``K!_dRFCAhR zB%^H_4Ei9-V;cZjZByXcaU|>dZWuRGNGvB186t=C#btrf)#;y|$F9U+Hid zeEnMzeECeqNwVMCkl;C1v7tJ$Wt}3%9VR367M=VOnh3tj-_yXhGV|e>yTGZ)Ma-?v z8#hbf(^7}mNBB+lFB=R6JK**wQ+dqy7nmPux~weCmmHhr6kTSIYO7rx1l9P}Pf|Fz zwglLFFLB&pjDiAA9s2mx$jBHg@2J2ACYooP@>1S4ZNJtaMg>d_v+0$`x+r6JHvBO} zfUp3;&!fi&-l|jq99nmY9KrDUnJSh7C>nqY7=RE>Wr$^=Ho$#=iDOijDEIq`yuBTw zay*0S*85VxE~ZGb6gFaq_&`B{Z*%Y_9^J(S{6cF-J{u%&M!hBxlb8Gqk0}F^iUQm% zya4t&-PwjzJgKbg={XYCmoWSB>(@O=OZInAtVEYC)Cxds?ZVT75BwAb$rZ^A z?>1MYpOVDZ;L6cqm$>YTLb)`%klL-!df-~Fhjfb>&cf|hB?LTI^V8AwaBukfnghi9Rw465(YIv$9Z3ftjt*kGy% znf*)QvqO~XL`*20SSW_A>+*F4pZd)Iipbsi*>|=}ulhf3?$fn3pM=ct17&6>Qj@*G z{y)bF5O{gVtC-y1?dy7p7gb{Bz*JG znSkdEsTks(@bY#pM1_60h%M)qqDn_qYrgn>XPk`|mlXojM5l^-(eejfw|*f#I6HR| z0)#`51M#p8Wr>VGe%zfYPFmzx8y53RNPr=7OHmWf(UzzD!T&qC&sF7GXDYOjC|Pb<`=&W(;&+R?b)m)R5&20w}=M91~=4Y+Jpj>3QCwBNtALzT=Wf#CJrSsHS`i!LdtMal@@t~bBVAH=Nqh*cWJZ5`Jnl)Gldeo<^? zjIRq8pH~NzcR|jAKStXR`>*gtlDsZ9*Y_zBM|@bW-9k9o6r?8mh|v&PM3cPjYYIU# zx14f2=})-O+4a0DXoq7gzZTP4p1+$aBqu6}V!TkE_^Bxuu@u;uOnx=(Jx}jhNM_8r zrM$V#ms8^wNH+%IN`d6N?=F6G3Dr_nzo%)S*!pq5h^Lu#b!kDOXRMbRT=yM!2H1qe zrkxf0Z)RYWT{V5dT&Ha8fAY6ZNE8PO`~h6Qk62+|e=3^OXj(vxPhjZE7dv^LEoepk zo4#)xzSJ$45XZ0+qs6^M#UO(U9d|Q!5isl2wO_N-*OixI9z_Ce$=d|;MH-^cBGqPF zE&{U{F$rWvI!vY7gsZj&dBU3t-Zj`lC9^Wk9|i+lHEG zRI^BeMK4{UF+7(W+_tVgC2@L#m8_ATju4sTW5L&oI9C^ALHq^_MDiB!g!~ zs}s?G#hTKb?Vt_{hage3)#XaYvW2rLV}==Gz_L{Obj=JAxt- zGs&(l;=u?@C>=B;A8jZ22KN4lf382V=v{ECv1)7gp}UKXu8M=PSzsPUQ%|4-K0lpY z`t+z~cWBs2lYA^zn@6yNJr7SfO)R$Lr1<^RF|Xj`CE@ElBdMNz^3vYk2d5Nx<2HmA zJTEMJ(OyJiciUoVEuA`c`02m~_`g?sUjfY>c#V5Kdg5mLe&y;Z>OA(fpg-0;3+JJIMDO9#a_7DxNiIgSBZUCZb0Stcy;uLUhXBvY=;N=ssT_xf`a zV-z+bB*6++LWQ&QtaTBrOXM-H&MVy-isb|AcP2s@%foNyn^l0|CqY4BpZ+i)gAE0@ zO7M#6sAf<;KCzYmcE!5pObgB8SdW6flCm;Yqd`oeR8Mk9qM7Pr9rb(44>bsFCHS$I zjR7GIkA{+*X`ov0i}Xq%Jzb5Bo4lWXzGqT*^Bi5dKm6?u(dY8z5DV)RtJorvcZed9 zyY9(y#C)EW(N|Qk0ZWvlyOgV&{I% zurMSZi<<^T9W?3S(*PGMiY=ljIUJsS8)j>i@)%8n z-XL}4*`~|7lqBf-6?+Xv4UKTPK?QHgrJN#gh*z0O0_xwxj2=H_lX z^qsE;n&fxi<9Kz3m|XUaig5MFTm=e)nhJ#D6aX-=CdA z(!py*GzDyBlp-w|uZ_!g&pQ_a|6Yk>jms@6@R^b(LvsLXHzFSqMJa5kpOhX?jx{Zo zc2Rr8d(BP}rOPjy{SIk;GZVodTN!b&??-uU(ED;+O<==cTUmO-Sr}j`nbS9^@^78H zPHyzv_?7mN5lp! zYJe@U>Dgnv4du8UBR0Y;{nWeXkbX~9`Kv9>ykFpefA*=JxLOJdExehYBZ z)Z`hL5)|dGL2RkS1>j~XM?u3WYEnfZ3`UT#W8|Cf0%&KRNc(rDKfi1DpEI}Yiulua zw%y6^Z?YuH4JJLSM_-N+`(Z9BC)A)rlq@_a4(5 zYs;%YzIZy8|GMGX3b+{4fDGw88?288DqAhBieg1CSFziDJr8u_;u#p9Q-C4`RMUV$ zy%4YW^pmx@osIQaL9K?$8q9&D5Zquh@E%~|uIaMhkI zJ#>3ejraoq#jS_2p|IBfV3;2)|bzab># zq=jaAtSZ0QM%aVxD&-A&9{;R~{<*1NEKKzAF$wy5x5W^M8~CEq=e+}8$lQSr&TC|Q zrMLcXL!+X~Q1q*C-1>QC;M;Dnx=ZYSaCRdC3U@1y*VfN7hN}KkzGg;tKlru|h@^Cx z5J7@Dl>AvNjw$#k9nM79UX74N{d0n-_FF@?`_>MF#`vXI)bMK6q%lT6r7SOU(tGiO z|EBfhvnao#YqV?9&IeZ_%6_jB$k;8u8A&)abjI4=MEqkx zfgbq`9cOS2erCv7Q_?0y3HYC)!o$sq#3*ZyaV&%3s-U1n3A<4m?0EAC73!RP8ld~W zyf~y#B!&dSqHB*><4Zc1p~cGV=L=o`^|kWiHc-9U&tP3KJv%{LjeVKwtyj#Wd#40r zVsdsAU#Pi+l;vySL?=7h&bZ$!i`~z7_gq*<8?-mz&B$w4*D|6kgu@wGIs$BQ1`lJW zEQ%N;mV4nkfwHlyxU^+y8Or(2rv|*rBL4$?tjMjE zr}hpRIlO{AeOtg2F!gI@1_&!+6SN)j-@pGrhn0{J$3N|*034OXZU#v0824#J(Xq=u zNoZzON1xr;N|Ba2){S0CF#if`JdUYk6(Bsz1?z~vY^Q|z!~0H@6j_Mev1IXK0U|7F z8XJK7@_)51oPh;er?xi9N^YJ*&eOQW_B)Q(1#^mV2vU0cZc}Bu$pX&5XK#G0y7KKp z%eHODb=}LGB=3#go(~~(Jd%p`R?g1rS=)=@1I)AX4X%bG_g*Y?7;AsK8{B+v=+<4d zT)ol4OS*2ai%Nr?I#IB4Em)llw z$ylJP|DMR$R6V0ogO{Q28D{BW^B@+fDiHUmk0p-Fuz{4vgNJ1~mF}$~LsTgDUDjkf z{5vjzMQPF6%;nDF1jRl`^>6sp{jcDR=b-rI@jH?&PDnMJ@)r1NiXT5GfV8gQw{Ob}xUxWRa6h-a2tQVZVIdUAcn+V0 z*5#Sq(ZO(C-N{L)+2#~PESax)?qcJrY1%lFc`l`#$#FtSfN%$0g4g)x*V#_Ybw&=B zc6Nk=f(9Vf@K%sl1QtzR`|8XkETijOhgo6xTv7kLXrM!%&ZN%z%()sb5oO&Y>|VJk(28J#YuvH{2|yP(n42s<3_hb z{x!j?KS5m=266=vp4_a0f`Zqih+2Fxr8`l=p1_NAYx=O9=4w?U!$ew=ggt6rh5<+2Ny-(IwAamf@Wdl|3yycL_p1vn$4qSiUZxF-2TQX3)xaSzw zVS(;ng;+SFBbREMDlv%rVs4rm>*9Mz+Uci8|A<-{FUfg2_T?PN0Uar`-Jgq039DEh zb=y7NQ4q}`W$L=q^y$7;7Fa`Q;IX2vME=n>UD9<6Y$XSTAuV*<;ci1%5i9AU zd0E(EGh-mxSUX5Pz{j53vCG*fZ`-BM=<4^-+h>rQlvLrsb%-lh#tsaCsLozKtVD%f zz@%NkJPiwQXm3(gt*h)=v` zQo?U-J%ZCE)f>m9e&OY-a2gwVHJVyewpg(=>bJ{!?IkDDbK@56pos9d^^r60C0+oX zKM*gCm(n}rfDFrlNe%|@g_@UAE>Tf0UoKDPgu->><6N{d*Gl`0jj%TgcOKIsh`El-2{HacB{t3Dli^7|Az`JvZJ+A z_KT|g8H9E`Fxv!u(G_D!7pMK;C2LGG`gBNOU`G-gGd)}IQFu&u=A%la2=4VbU+UGnB*eC(OCBSVLeqZ(KC1PG4E{h7h!~;s$79u<+ z*^Y-a1n;5`Rw62zUcw)gXCV7fzV-F(kXvzV@24IDY2Q~6M5J!`<(A7g+^tmbSVSn0 ztJc8Id9YRW{kzak^`?mpn!VKyv+{q2s=7MotdaEkzB`DP4Z(wF zUobOUN0Ia4AF?ZHikAC|eF>8X6crPGY@yG38zJSs6hdRKrdx7&~!T% zK=x-;1ko(|(!)D~hcNveU>N|hWC$sO*f3ZzZLHI1RozmJ7=$JMvvyBp`(6CF*$TF> z+gQDu01p3!`9pS)DSYkm1-WLz`;f9XK{>Ip@9PQ*%Cjg=y?GnORT3i*>||#3#G$9$ zB;^0m^p#;zc3s;F3P^W{q;%&HN;imfH$!))NOwsyba!`ygmg)V)X*K$-^KmB-~4e7 z4u8z-*?V7Wo$CzLKQ_ztH75%NZMr}f`@_xtXZy*}DTM@q4uMrc??+hC+)XSz%D#49 zIy#HtY3x9#SUVOs(G(x?0Shog_H1tBLv5^Mn^#W60pzHFh`{c`-Nu8OT3nnuQLRF& zq@>|bcY=-gsdX?5U@1ccDs6Q=?XeCL9=|DOJMsdPHM?cv3K*NYn_$Z|LIG`%J2aAu z&m-txZusQgMo!-#fGE4EIM@ZvQ?Xos>TI{waHNKuug`bW(6@T5WCakM{N-fa6SfX{pws8iI}`p%&;qcmOc< zyuS~oF|%3vPY9-YfC_0_ye4C{|MK!SAUN6{AG*7Lc(?^fI6iZ6f}-vD*o|l^J5#t9 z*XPF^`eXfltd}(jEK7#MVbjt@Z-aiY|EOc1)Krz%C3zy6>v1=uS&qf|Q=?qOtZTqf z?v~Zb2;z?>fgXVz;@gU1vR+Kw-B2UCooS>qM+_Ju<-wJ{U|dLxTcal5^5n-16?IecbEJRYl5!89>{&EG+;STe!Cnv@wCaSBb_!rP|U9lXbEqM;f5fSVW9i*peX;HcZZlIMulFKKq zKJcgn?B;L!Eux6Gj@S)*|2afQZ?F&Y^T!ad6)WB<3}vPhm^Z1#C1YZ3Yyk_hW8ugP z3rUPq`95B8E}lpVTt;xi+t^^?`)A*p(H8N-+YuA;9#B zB9fY(1{D(vOS1UYdKh4%z^O364$h*FX<1nw5~Zf3rlzIfr)xAEfB*PrtdYaS?P_n; zZzEe6_TlElW*$j%T*ws=rrQ}?X6KbmX^9J~Y31_i@Ns-oQTwVwv)0l8RO<;6MrMX@ z-Dyzb8&^HQAW6LV!@{Ew7=B*raX8X=vdP|4q$M#@ci99ou&+M2UYr<$ht$J;ujrieqHWL!$ybUB0d_Hw}O@H7WCA zQ-`_yLHlCdTjm=dn`OdcnGah`6-z8Vj4GFGnCSiGxH#{1B4lAo4F54zW#{J>mQ+;a z+8!Jw>M_@mbDa*)%kP(lv$0-re0_%8UTMa*6&*H3fDtt5D`rva`L*efN#IHvZySQ zR+h6%{j91g_Krz@K>-yY5qY2PtD4S)q2%zM+7#yq(gW%<(I%T(Tv$PVG7d`Qx_O4Q zx&DHmcrtjg*+Xb{BZaUO?Yq(_7ss@X1JH2a z$l&^CbeiSA7{H#3A)*4PC4fc^5aqLccY|))EV~^qsyl8BDcORyXeXB4PFMY;dV8Dq zM;ma}=1tN!|1%ic*<%2-QRU`cUbmGr833E{ZbRnR)Du4jBq3opXpFhj$7OLy;ds<} z4u|Sp5BCd_8B7sdNgO;Lc3_AlW51=thwWtXpr9Z_T7_Wf82tE|UsG{C5NQ7`z!%(J zFW=jX4modgDpCM0i>tsNV4VOqn4-8yw^w1;-~D5FKrx?AKtK|(H)eyqPX%SeQ3`eSyYC{!Vg0}mdH^}O9k_RO$^LrcmWRS zOy1~xIKUMx)jFt0dM@@ar9`yZv=j{+7yhd&@PxRt0+2$7Dc*jYUX7v%rFC^PbaQjVb9Hm$am_XQo{KPzvP|OK_cY;VCj3>U`;SKzUhw-r zIA+krTi|>=0HE$WNRD}%H}Qukr5ce7We{FG%0#|Y9K|(WaeceoL!L}^IpdEp0s;aU zPmzD=v0yYiolfWH?Pmx)OU5d%>DLKYdBOz(s~;UtB*AV^&cn3DmIu-g5Qj8k53tuK zT5y>@*+3lUjXxKD#S*%z;cDyc)!{Ok2Q-ILB8rgTus5HM!)zk6&0y-A7}!q?%B1af zwAO*<0Zpie%kw54ro@-LxS%eNjdUkdO&oWhY?PuJF0S9W8*!#NmkYu4}{DIL4)r;if=y^<=hdB$>?Db&w(t;IyWj(VnC!?smq;!2crKzW>s|_?d zv)FDb((pEI-Pu5UXGaGiKSh=;ZN1rBEVAo*h7B0L{uuYVAps#f z2iI1=k%NY~Yb=b+zk}o%`;S{#>`#-#f5lZ32KNf!{Zw44Od6-kl#ZhiKbTOWi*shq zf=|*#HKT+4q96}RL%##0=kpV!f}YN|ON*3VZq`7U>SMNTg#d}Xb3I0u>d$SzYnj0; zWt=jtZ7k%~g+`@|yJmweg;ol7O zbY&J_kZFGQQeRdUpH2mS-TY@N z>3Ol;q-1|X?uhr^RHP9}nQ7?fg#LHKecJPOs~s*oE5m&usJ5CyUMt;|OoG;Okyp-~ zb1&kcEkgz%PsmaNcNcxJF{G5$Br}I`bOb3mh|6xOR6f1&_+#yAhh){-6WkX~KzOuG zH)A%Q+GIc;dGQWp_YQQ*Z;vn#m%+y}#=q``{%?E#GMPmbxIOZZn*;l)hWG>Ao>RtK zxUxCIz~6xLavz}bt!AI1jAEW~yGBC}1W6;tdlKT@d%iAHuhbLp*_;K^9d1sST3rr* zFTUj1Q#Q-BD7>QR7c`DgFIJ!B?TyT1GcAm1xI)LNED zAj09*TQ@{{nYTXbPVWEKR3mW*D!p7xFS2AL6rmt5s}PFf_r$&@+?|>S$Ol*2Y-SoE z%iNWkH73KG`^IoCcF^VSas1QnuS)kmX4cQn!zBl40DtTTH5yf6yps2HWoUUYMB{9w zkfcVW){AB3ThP9M>tjEia?zFpm26Vgg?^nYtXLy(<+IoTCWZQ4E>O~=9t2O)$I=YI zX0bqgS?Tv;I7{5Gm^Jy%sht;sd-@BLh`gd5N7_5RVjym$$9C zb?(-DZ>kzYkNktPE#LuE1egoEordiTxbL0C84t*(An;QGLR%KyMwo#(>y`GX?8_;v zPZJpdhKA@%zGn!S6D*D(4b2|%&YHCQRB~ISJgVaNy`aY$=nGeS< zAuLPz&Jk^C%p38qyuN?Wja>0mpWny&<`Mjw9gpq3b7k;2MA8}c}bwkC9|2D&jB1Rsi#Hy;o%Z|L5if%ek1baBYVXjr0dH}fpQ>{W&R1i=-RXP-aC=U>sW2xd&sG|& zZZkXXMK*!c-cL7E_?HVmBDqonxWb3{xB5Alk-P%;9)UZxCTm*r|L;mQ9HI*d(5eR3)=Q6Tj=5W=cKtQC|Q5KjOx!U-}yy{OUBQww=rY z!Vr0kT_%6E>D}mgfM>ncQgvrrSw}%?Vh5A8dwo48S9wuhPU#~WUVtj5rvpqvPoncE z2_*aPV#ixj$?1204C?9i1K#Edgc%z4^TyN7fXP8Dv_+SNz|8!34Txrm%lj1OK=pS1 zoHVk#Xd;vH6xel=;)68k;>+Jam;Xd^q~s=BEI03vTnwqQ{`a)``oR#=!y6$6!z{=p zba5OZ*~CJ+3jBUR)OA~<#lc?_JFu~BzMYAsrKORzwULnqnprIE(+tLO40V;Q!TT`i z{WXz0=au!lxMQ>F++zhu5C4O(3DKT_*$Nb~3`oBti@Qh^njpvb!KBe@0r zk{uox?hn8BDck0mQrXPD-rkJ0uaH=ej>#cA*E?Ssywp~9c2?qw>t1Iu&poTumVyS< zP+6n${X-;0S?scCI>*vPHwj`cj@I&;$Zo~~Lur^(0gokQ6JXY+SL+<~nSJ6N8&qsGYyz4CugUZOO&Yi|l{a-y1EK_HQ7$(+j z`VGsdS2RSe`2Df;BOWJ!NOh>e1RC@w3jEDFST37@P( zgug|ZU~@U6j9L@x3Ic}IHx^6CGc7J5(GUY!Rl87YG*SWV)7T8o_k}^^m&gf?hFS}| z6`|t~`OZRq=NEtvx!r1z2h|s7?7ZDta92#^ee+f-f=%+o63wWSu&|OUNId`?|Gxrl zxlD?2{3k-o)pknL1ld}v_x;%#)3fZZ90`BD;vjC+3Q2{0)Rl`1C!HmI_yr=6ttazp z{CPkx^8yr8T=B}^^2`qj(iU4eudc2vw`XRXH0zQomH|ti9Al{MYOLGMA&>p!h9RXy z3;~btCV<6)F||vRwlp(0Ah$*)?GOMlB;4AE^Z zP9ugROd($E8DoyCQc)JYVbP_%F4rMMN0~6lT&}lR&k==I>Uv!r&9$9&3yYrdVz!H7 zwsUX_RB3hKPI)}I20~%KK$XF)kn^-scz4oa1~I4`28I&bkiaKu>LQz>mdGWr#KqiN>S~jDXh~NjyvQ z0n6LF-wl8WmmCBygxY&473)Fc3COIK9p+p;HZ`f@Or**hoj%tK$eus8OmhEUNzp-F zs610bHS`?AE!Lf;QEIcFW0JtkCcpz|-Ughl$<%4ej!-YKlv_BOw@e-~P2rHe{ ze!|J{J>)ZgLLe3Af6uNzzm2~sZ{|_13v{@cHN6~R2rl1qTW;){SQ!HGS7q`_%4+eS z4r{F#fFKRCzT-pv+n_DbOhG z#*>8>t5bi#?=h3tB?-X>t4|=ulK&r|Ul&tU)e$J<;GQ5xmAm|z1}(RyxYjYH8pd1Y z82;aGl205n%l{?W>GgDUa`$uyjX9jl&8h1EK;RtU0rm=qhErHTtXK&6#HqPZDm*=D za2s!!0fQI$^oE1k4llF?ay|prpFvTi9EKEZF(#yX=SN*|W*(ashVW=)g1#45eA|#J zVRNDwz%V`}7&8n^QLk&8*)pj@jTttw&q#u==0Y=^d?!bd_F6ytawM9aY0PdfoT*Qc z=?Zol|Eeb^X(whHMNey>#cubO5%#YicR`n1Q~Rc-RIs;4j$~s4Jv#Wi+{i&H$^M-d zi709x`BDn^i(+Eei)ZoDfO9a(MA64{@8czxALEMX5K+C5P7l0up|s+qV1FuBmdL&x zdyg;R53@Fuyvga%AM`cHG3PoCFthlRRNcU1>RNk$D`K7u%+Yz}K7vRM!%WFUPS5yn ze>Eb6n;HLfzIW`ml%l$_D3FFIt@JiYF-}+61=Bfmc!Z&(_-%I77?VwgAW*!|R^Tbs z3mO3h4;D=yrZgQy{cr!}4N2S0$)K|k6N=4xtJmps-%D|A0JCX@EENR9BN|8TH)*R8#_|!NaIaA zu(T+q9ZuwtkF&1KGs*6eLH$==Qc-4SU}Cnlw^nSCPRcssgwH;)HK3R#V0wSV=LBU5 z^q>OHB7oqW@_+BROuYmMAk2yaqI2BHR6XgeMw^@G^vLEO!9YL&`-Ccws;Zu;Y1ZzA?{z?hgei5<+(k<{KuYCj5bZWC{3H?7 z;q7_a>wkSYaC7d$K9^U_Ko|S5>jf@4yYRN225%YK$Mq^Ov}%) z9?bXe0GYOMm;1$YBb58KKl4zf=EQ7W>haSrX(%DYeBqjJ0uqXUDE`yY%0ROo|BZgR zcm)K)R?oAL>hd@GEdKPjAzDf$*fXacNhrMYk^=Ik^^~Lm&|Y4*EYm*+D4*IC%TNX3 zkpna{6ACvh3@>+C0=ZPJ{@8TydQ3dShK_&2$OOD;yivFfznDMJv03pW|J4MIaZo4H zS0HWmw6oG8kCcbn^syrwt++byWy;EQxg+}CICY&ODZX}U6e{D;cr^Noe6&Z2)0&QF zib}sE8KldphSuul$C@N;yzLz$Zm^k@m<|mS7x{s%xzt9Ka+~@D;nd>buj&3Tvbw@a zqdb0S!$TB8eb$bqTqsN=KB8C*l5Q;P+$3$+`@j@07GsM>0mA0>`~zTOFl$F6bT~Ya z0#ORV{TwM!26b3_bN;j8gls$(QN6!OV56w*5X0p_kIIE0|4}D}0{_e%=jV7Q8kOVJ zJN}R$;3JEdiX;j+yL_+Atx7%ko!mj@{+5yH_rycC&b!@=BWn$r#JD(e+-idTVTaT8 z;C6Rxd!xZ{f<6$JYa_e3vl>-dPiKsY$+KjnP@?+RZ%WEVd-y3D3!rB1Gs~mZW{Z(V zVAOUz)#TUZ`;@I_eYLF_k@R4<&`G9Mn$3(n5VYFrgjd=aklED@EB!mY6jS;4r}%0< zfk3bk)d!^}h%E9ImE**_%r5JU&w2X)(&Aq)o`a7tQ#fW<9N(Y!;w7lcWMw};9n_+6 zfj@8bB;mruPhAssjlJat``eAjO7&B`jmS*GCL+CO-|I;1}r=$!hT`f$Fjjc}i4%WK!;$o`ol-GBev>T3R^Ij&|63iH{)*DavQh`cU zryVexy&PYCh=Iv^C+OwhewkkF_BXECnqL^i64_&9Y4h4eyf6A9*?<1~9ZZ0zOD`M5=6$(XGF0gCg8D=r^UxiRT`4VVKFNt@$0n}Vj% z82()0VofsN_v@)Me|TA8_|dBaGm@&oo6Cgz;k~y|@>qTWjYO9h&eg_l0}`;*S#0f+ zPHq79?qh=zKmJ(;n81GrhZhzm6*k%m3i^mrqH9xGW?%e+#%Hf>inYghFfUCm3xi}PzPG(Q*?Zd%}_zZwz9Z}#S5=Y%Nl zVMf+cQ;FH%6xl4&EDpUVwa;jBIvy*xPhYUZ@98ltU|DUP_;|iC2U3z*2{7Elx8F^W zQCi$rS{^qg5vL~{ zFFwAHr631J(K@pg1!Z6p!^7>9{h3^w!DwC2TY&C5+HY~GZnxsGca^9e6R<8WCMF?1 zI6y;1gSnf!Kqc+08kP?$SoZ;BEHFO+dXbc9e61eP%F6Ru(Iy#oY+P}b>Jw31v^6#H z>xbTwH>IP%XO|Uag>8?isK=`gSkA>h2|B9E%DPd{q=q$EbeZs-wr*ToF(#8;Ko+CfP47jMjt;8 z?5q0_Rke&{6xS5{{-He>2M&9-1}fzrOzhqGZbRs5AgoJ5p&wNkVWHb>L}zk&-)5BK zv5bs!DW^>NK_Gf|`U@WuIcpsq9T9I45hD?60E_r014``Kq;OcUrb!T&4U6%;J-EwD z$BQ}EYO+5l7VZFXTJ2feNGT=3b0!1`_=SZ|QCIVeCgv6ZRhYTCwWY0v4RmjJCRemd zIPcTM^}5r|Ndzl?qkMU3Z;&A}F43t6E~d+Je1sgQXZn=G6r_2!yp@Btla%Gu~IztZ<$L|G=i)NF6j{HAk4(x3Cxz zkdzb`m0(9TBzy}3UNmqHgmmom+(LX&zYQqa>ogf@j6hs`+?%SCecE`@$9hc$)0286 z+7F!e_3YDXiJw{?%cvtkBRU5#qAI?@jME7cr%ALGRMA<_&8?Lo!$c z-VPPaOvfk0W0L=XB&DULASBy5i+(c_(UG&3lk-MQjBbt$oSEIT!dwe^x5n#a|Bx1x z5OQsOIMY41Hm#wkts7TA-ld1r#u587@s*`T*9upt2J~J)dL4nF)y^N-qRP+SxP+;( zk-%AHE6+V7*y0myJ>u(9pcMFQ#_OM3gP5DBazp?%Sy*0PMnN8&Ez1S?22%6! z@u9F!ht7WZ@PSSR?q*blUaUuXs%WcMZ$-$@eB|K0vgEys`N6J%m2G~Jyb?L=a#xs1 z=ng^P_V!N|x}|GmIVRn7=cCWIf8rb3q9I+^+p1zBS|Hm}BXZDIA^lM7m+BzeZ$lLk z|6MqZ`n2(6hFpG1r7l-E)R(tcnKSdFpP{kj$a}*_?xS# zfgVZIniQK3vCX{f<7VvUDm0uL4u;bRQ4-)<{2>)%Lgjt2YYoEtkMD;d*hGZxJ9~|$ zPBbxlGc_e`QK>cll}W9o6a)*;g47IE2w1HR^2CDLu0*VszhPc%LdJFduISluan-1? zq9(rje<_&OwC6Vb1krsczx3-D;D5blo}3etyj^A(O0sf|Ofty>$Dkh{M*g0CJROBP zE)sL&DG?E-VVK{E5HG?#Ubs_)YKDI(LRtTiV?&i)_qE$JuZ$xhpmGFZQclbmmneSp zE0;vxwE6x%`h)Oz$X`eV^-VjZSs>>?i~;g7jRfh9zJF;NziN%DPxj0)6Mbe6E#gPgPXU` zY()AX_b9?B8%o7F+n*#a86dT#`w) ze`d7sqU%WK_S^w*33QY5uVb+&=87HW7_)$Q%!D^%4mCA3Q-2k!PPF-I+=~7PUE2Uj zg3`<{1o6sKvmAA<_UD#sorBp^31F7X+gtrEhfBca4fSNb%WZxf0w~Lt{I2@Xu|6qe zc3|m$9pt!7VA|dW+U63ns_A&NhYtm1@xSMhlB?Jmd!5n>4pAZyFD{VIM)el(wKYV9 zw7b$}oE)66@zQeltSe*D^zi>Cjc*EnOz-=F$bw3h7)1P$H$B9B9NMiuld989;KL9l z1MX%-WJZ$d+>^Tsk{kMB%udNE`hlks1D12}Q~%(=KzD!qS#pztZ5n^O@gWTgG1C>- z(6{5yVzuFxOP&(DYN#hsX-$W_JnmP4AFyZ?Q-z#v9)pl@MmLIshIyT_qtAb*407Fa+W+*Hj-M`nnBsxmY(_IsRVK(Do)^^<5kx&I;_x?!Tp zPWQXq$KG6{X=%T*-xnNW=<#M>G2{rWh422N69(d$g7dJPn(r=mY{JCWA-8{(Mp2!-R5QuqZAFXv!_chb%hJ7)&7}Z zf8-S9{qrxg$O&{hD$2mthR|>8%T1~wKs2$-{!$0nuB+46x1$w!U*N>kB@9dn2tNCc zYf9)Uj{bHYsNuRuRS2JrQ78Bt6A@tmQF^=S;7iIV)XNaV?sUdTzqdO~SNZSWnmlVH zpx5Xf94_e|19~_|o#RD>Wy^E0ifST`SvZER<{RZejX*}(W&R7`*$cfhCjUo}rmCFvrsoqIA( zW~J+H@KWhTR~jhal2#M=R)skgb|z+~TYH-)C%bCveRXkeTLV!Ygr4reY{U}CYJi>y zdPWMelpltL#p!%wuBDH}25zY7AKt88E$$58)Fj}_@v!^UD20xsHZEJ5pQXP2`+KLs z__t<}m?mJ@@EiHohaf3y)QGWUlN}0?N5%yxTtJJs!v7eK4YAqA5NZW zoY_>nYziaW=kW7#O7IH`3iSh?g(<|bqB^+!5yd`1jH900e1QW9}Ovcdnp9Q50R1Xm-PQk&&rxGLQ630MD&6J+fhaJF$qY+ zqxHJNzWXno_KAqDxBK7)Z4g~P>uP9dh+$IzceoDlBzM*k`Q|9&XvF?ih=zs+gcxi~ z$=QYE_i!{&BFIpLVtHy|XJeLMR8lB5eK&zoV~xpY?h>99o$2rIpHowk8dT5#uyj*P z!oq68TA~s{)MpBfPw@VnxA!|Uzn1E=6RK~?2we>Nu`5Y)|GtfB?&d*Bz>CJ;q~D=3 zO^vK~HlNH9?&c(!Krvx2VckgnwTmcb6vxX@Ro#5EZ2#<%h-j=Y;Ol$~ge<*%%X9J> z(fjJ`1hCSCg|YpNfb8x3!VT)gwLcWz*c!aG(?dgO_Prd>8;pTHU2i3|-@2~|QOtr9 z^stBSjsdz%LEq=c#TiLJ;L`GNcJ35-vQea%DewW&mk2|-6P}WuhOmx+0D4w^HrdS( z(!@x-+}0BD3O+{%)AQ**#3V$%@^I5y3zL$PP}!#trUnLr;XGTfon5Zw%XNvkZy=BL z3JJZ>3`I_C1WUkgUPPb#_LrzLVT~vHRFX`P05uA{1cq16bn^8Sc7Qi<h363BI*3 zn7u{dEg3Fr^#Y@SYy5;L4Tzzs8elE*R3}OA?h7Fzfoa z7?I2j`Ruc~_d1@}>vVm(pF@Io}F>#}>n2+T54mXln0&KI^ zjz3$u^N@J~0Ry`7E~f7n^-+kvHDKq~<>uCgr=_*F!ig(uYfDN>s;g_u0%?fa6GOiX z3=`CxL=Ffi=@V{TR0b~H1kZsMR5hx$xCEgW;rIT~hoYjQ!cCGI6+$j1J_3?FSh$2_ z{p(>3MhTPMzhQXj@1P$k`ozppL(s+v;AC=%JbFiuGTH^C%%QtD*a+kCGtr~%!_d22&i5|duF!Bl*r)jZ%y;JKd* zcD~GMPv^NxHuVC^M?V-8W>kslU_NfeaW`)j5Ei%1MhYPXfz; zH$h{A*HOXn?Q_n5qj2AL8EOk@y6K8zPQq?JYHE^GmfRxI*)#>PLrd?E(urTwa;V9l zFcE^h15I!x-&ClIAVgDsK@!_DD<&|my`xyL9D?@#8!iV7RKtsS3GmDG3fdp6iXw@) ztY`m~aDXRLIczo;FhoN>qL6X;KK`qr3`QXkFgZhT7I59J?g@ZLBM`ED1k4ErkjX&K z3ui!fl42&vV}*8dVR*)DG)2e)W;)-(36D{O)o;996L_Q7VKH(8P+9=T4&#ZQEohZq zo9oWzeqIRb(PEwPYHkVTL;ZCv&z~s~dmvqxa{uwuL0=lOk$SK|iiJr&O1W-(nu{K; z8uYT(hz2Iw9!v4>smJCk2B(Y@QEX8%4LL@p2}sLSkS}7_Am$DcFJd!yrirv4r!BqL zVH_60#zho^Aq_zhW%~!?A39;io->0Re0;fpOpp9)1F2h26wI8CmhQ+-1<>p?7d?W4 z0uzJ1sCVOhnqO*5t@t{fG5(ovn(v@>aYkM7s7Y+BFjp)&69{rgc~yWYpWPN?#?|5CS-WPWBd1$O12ROzVX|OAx0V)-gNl6HTO~+P%x>E zz$Sr~(;fcoWOM}jc!>0rH7X33h%>iXJHV`ty|_GEsM$2yu0%pY+Ta$zdQZ~J`SXX! zS0U8+ttnc*7QVfB%gw=U4?G2B1>mca2j_t1A9P&*#6>T?@~34# z+cd;Z$m{9g?g@#XrpX0BYMq^3o!rV!4+5i!i8FLoS60J}CGnc>uUB<5NPy>L#_9pj zS@G$?(NQES5x|((`@6e)fC#BtllLa{@bL6};Iv!Kk-g1aZM(iY{OsP}TvE3?3gPkr z^q`a>C`8juvgw5=BurOyz|=cD{374w8DJ}AmsghLfeno2t2H0=M0q-@wy^y1HB^Ln zW8ZN8*L>C^_6wlS>eQhd8P33jyg&3mhl3-vE#LG9EZTvMwlSrtL!N~n?jJjf)vbc8 zvpNO?qNFG?200mK!X?r}ynh+@O-d7Dy~qnN#|+|0Q(@Lz;cGgFiM{IvQw$(Yt>(2! z%gW0eR|6mn6B9KX8#x;_7Z)`hn~)GQ4G4sK5KY%ZdnqlLJk?v|o{B z0HuX@wl=n~F|{zYim_`HYtmlkL)SO5u`xA<$8V~sX>4q)ak6)GXl!b#Ymkhz+t^uc zj#H;3TgSEGcR4+tZ*q&V9Wny;_3!zS)u{oMm|U1LmTeR1!$)-~HQ}IKU_@u~cYC$) z@OvCl-=WlO%sz66iFrEEAyjy?Id=Ci3D=;{qz;SR;O+|6|Dt(hkSB_D5#qV7;6k~Ndo4(fW!T-nUGuC^-hn&wbwA*72r?5 zgD#URUrDv2(gGVVS0xF9Xva&9E+~n zRe96zHC=4(9;NAV#Di!MFS<{X6R~${e?0PQq^G8(X=`bvq^A-RrQ@e-eoRfzr8LIk zkVTS3;=uAo)`xkjC^Vxf#QpBTLFMEmYb9oJMSvtLo84HK5YPeXNQlrD1t>N`YkDXj z+HCAh&5DaEDrrA4h*oy}vkKe;_NlJo`s`Yrc##ln5HfSaF166cQc#f7A+w9iYbiYQoTh665Sp6y2 zYBg9pTI2waiJlfJ5_35AR|7oj7$Ocwdp{GTHfLZAroS#E$nSQvP%#mE&aqpy;=Mgk zrsAMCW#?^3$MCx>Lt@Cip|z$(h?Fg-O1(-?@OA8P^_KXMoPZFYU~fM!z|#{hSjxUw zT@es43?Yyl=2daBa|1hsn-ln#otvYnzLryRw6VIrHbC>+kQL=*AN0Q`Ft+r>qq?+& zp0sK}Zh^7E&hBcdQ%vfuS)(Q(Vr3*K13iS6k+q4t zyO_J2x3`Y7``$=$4@-c47n0Y*!QEB}+KHe$5EoyU-OWE=rQ7Mvw{fFu5(LByc|0x* zbKp&6eRg~7UIP-Ok5;_)HvCt$dCD*K8W4>{6U}9%y2US@g zDe_3K3^216xcm4c?rBg*hbpGfbI;ryAg@_{Jv~)@y?txJ0zU4i;}HJatatB)+DYv99~bMuEbuyL&EC7O!8@qL0-gu` z=agPecB{<}eT6o$$a-}~i<{y|N#!~sIiNp>?PI}JwB(bch!bA)xnlk|dz=lA*~mARy;y>&rb z{rgWWq~T+HH$IG&f)GwT2P(KxYlM8*>0|B9kzTMt?y&5W5Ao?%5ZQ3eFkDGUOcz{c{?={8Q+A)yxv)=4?D5jj8UwF#-vvH3j)ukp4;*D!uC~ z+s*m2pDCo8gO1rfNi@2H^v+vYf<%_lD#w}}t({|Z+RVP0m>ZbHXQZU0$P^S5efrgj z=7)E4;v=WyyuG{uRs=9vOzg*t#Tj@W*h;-l=bifsq9J@Bwb0;Y4KUdz6>0~M+;f!y z#yK6fPg*agNKhc}*yfo?7Q?nigWY{aO7s|&H zxw^SHxY+Iak5(rLs^IX0+Hxti_YiAc?49ka8)|B6>%U-2G-(*JAX~X-=MOIoeOd3u zS0Z?;si=r%jQ>|dl1QYv8urVp_Dxh*7f>LIUEq;l|q}ypS++MOZ z7){D%y`93ACy9KpT&E3CJ^-Q6T7}bc(pVhI&AH9V;qt;r-`L!*MVwSaH=a-Cy$yA4 zKXlk?yN8gM`6yTceLDrewS}>jm6eUDp{<#jrL7_Luj;s*xRMgO4gAvN>+2jTO?7p3 zSy>`Bd}%DieA+avG;9;k+Rsj23;^-;*JGP|F5>?V;) ze0%rNGRq`;_>ya9hs1z%-m8kMgv7Z&FRLostNn7YaJir6QGbf2C;Pj)c~)tpLDFw) zV2eWw&*C&RK0X?_NMLj&!HA9cPass($$?gjYIyi%7ps9$y?Zdn#vlFEqx7)yim*&2 z7N*T_J*30)?!r{cd|{cV2XK{XaXB2Q2=Tu?U2XS1xdIw1MF_v&?rcs6f0OM}v*E~% zjW$oER;&41Mk)uCDdjWx{vQx1fqby;HyP^>`_$@cy=|LpkO3$b8$(MX{S-*S(}(xTbjX{Y3Q$i zQCxp>AN*0gw4wsGHS*l7DfxP8!hSfA94K+3SH0k_=;xbxO z)z_)P>$R7D>zFl|yE2D%9YP}|sh)RZYrZGK=FZ%TqL9co)pfm6(Yya?kMp5$UWDjuzuq}?wn8axuPtCz*g z?A~IjR^xXdypz=VZk~~x0Be<4%Wf!T0vD_Ct{MBn;46H>`x*LFWE#E3l(e*XiJ%rD zURK7@AtuJ>!m%O`?`@M*Mgd9Xp}$XOu~rIVXNU7WEHJ=|`yOj`SG2j=>I%ADEW`oQ zDZptOz}$3!CD*PqTP>77oUhX0b^B9al2A03$>%b?U>I zJCljB0<5&o%IfM0MhHgiF>%HR{m5)93u7=CX|>^_>^n0l6iOh9D|n?QET{9WGnDXe zv@U|g;q1&znYyBOLT}<_r9_5?V?aKvYHt8}@-G@{^8FaZqUxib}Rd zeTL&1AJeUy%UkM5oOLO%rc0Sw-ya=B=}og90>mmg*>K1AbboKr#tu*N#ZMfcm&NPV zN-Xf*Ks^y!y9g+PWqh3S>h08qez>9hQ4HUu^b>`T*cxHLUEQ03=ccp? zRW#G9&$R=4e%?QN@}Vm__Jf)T!>oClR2#y|7;jDBqTuAayA4eEzfBwTP$Z^BdxO7y zld+_~rxnCmmCLL1fRQ#+QxG;J(O0AZVO0zYq##k;Pgy{FQ?%!8*AbgNpSR;gA6|La zM|*KT%RE*3b(V7nTzkj0cXfsGnXHDJKk2XrVu)vfjOdgG5S_S;9{erFn!Es}Hw2qA+}vsiLzArmRt=F+)g;^l27f+Ku)Bw+ z$LAtyWBVAMrLWasnOn~qf$Qk4057|9df`NM{U8I!lB}ZCMEcUMw%Z~{?0vI67eaoz zHM7`TzTyb#BO2Pncza?rE%bs@3fI=(c98n$!m3_y3jX}o35p&caUQEdVU-aRnvsy6 z%s}lJtU-lKPGdw>XP5(9ZkwIwwvUb=_e(%QG$d@8uEav4gl<@R7-4+!$Ge>|i_n>7 zoUpOK=lu;)AN?I2M6pQV025W^FT+oIE6Qo0Brp|IR$5ANyddtXp;b)v zN&RmS1F}Pfw}U)&naP^x@8?fp?HTKpgQex=XLkq?ySu>>{_Ayj7PSk*G-N4HowNxL z7lZO5+*HTs5o$^X27m;T{kId;$(@{7K0nxa%J0OnCvQR##W4Q+K}sx==>L&)4s4aZ zZyWwioSJMm*)`cU*)?ghYiHX{HYeM*ZQHhO>s|AI_eWUA-fKV4eP7pk_N;aue$!B3 zomGLewS2!Z-kI++4u-RnFqN={slJfLsi%J&YHr>qP@@gJW6Ye~uTg~~zk4K(3Xe{U zoJx%a{`?|+!aqnUNPQ$k2ak&-sH(nk;-^H<#D&xkN$*v5s}{~;Pce@fFq=qAXwlyS zN9v`$A>RoD*#+khbPw9@Vb|J225lDahq>!qU=+(?GgQ?L{_=1%*I{{zL8sAZx<1ob zT`1=1%>D>PKmfm%MxIxQT?$a~$yFWed{z<(T=%~ko zo>Lv^kc2K0=Nnf4U$=`ARHQ5oCAH+ZO|v0V^yeeV*EjUyr23Sq=e1cA*^Nsh2+2^g zL3MAx=J?r%3@;-3(_2UD=eyU@72LSx!%l6cA8Eq%_b>wEavf>Go>D3noGuquQ|A80 zksRM(ZEo!T8{6koS0@tPd6rw4%x3;$SS%D+#cDw^HaY4S@28fGjg1l_?BB>h6i6Ht z-skh64V5mCOAJRrK@M(ZE6B-7MMcI5X^Vx7y&*rVIBOETT5Nhn#)5%DlD-r%BoK)k z)U~Yn=ht_%n`Jn?^qiSympBNxN#UIZTS_aLcv~l%On^;$e|x%|Z#jA(Fo^V5_YXW$$8wA^|5s<;lbzDRj*8QkRp1MogLmKC$E> z+3Mfce&}LR7r=1SLRaqOlU8U2K0!}ajb8$ySq)@)py8Du}^*CgzCMU+?(=@`ir-wG@287PbsJ7sz_g1EmOaK z^-l=&1w2)TF@2__A0e@@-d(^0+?BS&aZCOCU$q&ateWh+)aE~Lk>H2m}=}kYtzuRd!c%Iiq64-lqs9-#7Mf>gtqt7o23P8 z1ldoI51&Ij(ZfSbw09>7A_c-@d+`e24YP7aTLU8wsmp40HWlg%YWCsh=HMaS7-m}n zHBvOz?`kx7d@B*V3NCpvh*!>03Oi98i%J6K8s>=6CnC|K zaZ{3&+LLt*ELk5qXB8_LIFyEc)cVVk8=xLH(G8*Z_K*zWk)W6hC{{;eh~T$`Y)4Sb zmqXrW!f0roh8}Oq)P$#TvUk~^v>u@^|M&1c#20-sr9c>W+{41U4yjTBa$1@{l+=j3#``SI5# zE?2@!$P;pi72&tH^eLiux0vn#{x5$y@`MPCgTsB|xU?9e0pWuhPECZMe%&8xNDT$3 z_;O8UT=->FHN(RpAriw#U9vJk{5w7IZ81P>LEix>R(8b_JGFdI~@!L_o2RJh>|7sH%2TIq-xZ|>dLyq^fq$hZ>knj1U9k}-~-TjZNfhU{x$0<;*I=Y1;ywDM%*7tK&jCW3iLTXPS|J(aX?Hjn)Q%_sy28sMSX3pg(sSu0%ex^`}63i@`ic4NoI zQ*iOpb<`wr;m9)i)yT%!a}GExEZs~Z2yy*;HO{cCp9U!X_;?CtYENlq|no(Y$qb1M8WU!;}OiA znaT^mNpfC9SI*jbh!`_xO%pFlqvOr$9EaOd#3!;kH8#@SUn_#ynQc(WpkDtz6reHL zgKFv#!@&%+Vx&S3?S5hcfV9sfV`)xNuc7o$t&(`T3c6(5W)<6c*e(NaqiZKQKdCmNhj=VgL&%DIL7d2X*>iEHM-yLsH z5&6%5IdqLW_>dW1x!OJ_taf^Oda_U&BxXH78!+B|a&l6IgH|p!1eI(KQ0(b#s-nQ8xFcXBBxrvN=w%73`yM3_d zov|_c-1gUIhr1h;#lL<2onvtXQp)%^FLf77_ESgLqwJUb&g>ja0TVkCHAEd+A(O6H zQ~WuP%}gpCuj!v;C2Dsqvf9`;<3>g^k(4}5rPS%S01sH#zd&{9(C*m-fju{CB`%92 zQBF!qM%veo{=1#J9n#n9w3!eTPEGHv9863f!QU^9Qzc zmk223+SFYpBuOH77OTrn*f2PSne(S%7ITCE-ePeo?7NQ+-cq&ecnP{xBCSTf+kQ_x z!>I!UtNZ|liv9sKquaLxXu%7tN9<9R3&xN6#26h)Y;^EK46j{GD=xQP<(jJ?gcn*W zQWWQ>dy2NviHQ-kTLo>r)Qz>D+oOnzk@~y)rrGM}hj%a9d-3lovoz`pz0(JKb5-6# zHv_y4-lhe{6RGD~r|*bR4m8DPCiBeIwq{%Vt3U+px;D|8mjLPM#Zwd3k0I93FcH@n zNtC5#a+9}BX6E_yMcyG0X0eI6xd>|^RsdYdYd%a*0)sRz*~JWVhbAube%UKu5SauY zj=7F#_oEQ4=uZJj+?XI`{`9dleWXyWsx(3nN!PLgLR`o(oN%B8YidvgW0-8=H~xK# zFE@ujjgv5abC;(+`}T>qau>lJ$jhpW04DY4(iwK#U?dKo%hnb!@p;5|*cL-3GOx^! zMS-gEn9nBcys#t6eM5%@CJ2B$Qmu*Qn9XVbT1=j08_~>vBEQ}JWox6IdyyfXtIB@x zUo-S#qs8>Sgv@^6{>Fb@N#~=Sk~3n%(?nY;-K;}0`}&}-=F?32@N-Fw+bpK|&|CQA zzHn1IPRZTuZ^#b4Oi7f^6;O*UDN?M1A1lMx#9=d?U$$QAgTzHhYxZI|QWn;<C zqihgmOOfpbsea%3ajfJf%UbB`lOfxCE64#6Gke^1SJ(Hnl$6xem*?+a$0fVv!BH<3 zC40VFcV)S=TBfFWIgsl0OGoa3>h*JY=p#0UFf*=9?U5j%^F=_30vo`oqVoFDxo4m&muMwa?nBi_T>rm}T-g z`Z`Ovo5FfzBRHsmT`&WwUKo#}!T zT1pW$Li>G-2~5S4dkq+q z!U(WeKU7EykCz-@B7MHv=9{}PvY)Ly6rWqpjmm+mxk8em|10A{4HRIo0YKdj{I@`v zl-fS;+lyX`3C$MQ%jw!gqDmp5P5<_9-h}A)AD&OGjn*6f0fPlo%{ys5)+T=v1osI+ z_A+Z%g?Hr_ikXGA4sVXlilRN>thYCIS5?t)dxq15e3;d70zzZG_AJfHRjPeb628b< zQ*a`aA0wBAWj;}-%}rp)EgA$|K3^OD0|ixODTmVdXfmU|vr1EL_XrpCFh(I7X-D&d z1eS2@X3tJEZGKBCIXGw%-;7)e>F{~K>>ZCT5;6D^Y#=lN^UM6wFN=OPCk{~Pychdt zdtbvyY0E9n&MYmZ-Jurty*dhNTFbrmS+muLiymRZu^vka`!PvLDof0dH*(BBW8yH& z_}wUI0}|iMeduY%K_cs$yv5~yk-p*5>8D%qt(wCxm9(D{pHUPELpTU+Vn7-QL^krl=EHx@DKGX@rTTD(Hc z=G@MkPU|o5gxp3KvHPX$7fV1e?3fw2cD6V?n{`Ft0$_wTWSjeu_)--sKDQ4xdccUK z5=4Aa()J9!tZ7fGvTf(cUs<`jzY~j+L)VOjscpQwRWD5J5Aj2gJg(cYTVE81l@(?s z%LFhCy^Tb%CBhhKDTlB# z#n_r+zG$dw(!Zdnb494En|G!q84FD6__x7&T|aHW`|r^#T5BOTIXo==@oaTIUunJU zD{V;^%vpvnvnZn*)BRac+#Hac+;RAaYkgY9q4wNbHJQem8~7#Cm9$h&cl6)BLwVIzK`qSRt9$+ z&D%WYge!|6>y<`<6U4YO;{LIAk;iU;Zv!lB$GRpuDnKc)$`fMPOB2+UUp?ai1cdti zo%H!SE-N777W>R58IVq4H13Ywr+HhfxYhyU6bV3*%xbyK@wPw)m+hR-?qZ-faa$s7 ztW6y<F{NC`}|^kGGYUNbne{pK2OAYk%VkV+9h z0E^MH!}70k_1772IIzQFNg@>Wi@-XTuw`VNX1opwxn>0R*4uX9Da^PCLyjqrYq2wZ3eqaWr=qv5Tvs#`4 z&4aixA^p~g;W>eS%Ef9Ud0*l27)_@a6dyO4nZJbw|3prEXm&ZKV+64=uyFPRJLiN7t&YgTJ-!aZ6l|SvWQ6K#H+FrUrZOr*Bajvr#GT}J)fq)n?r$epA z326jhgj`!!?d)W}b-tS82vlQQ9gb(}H72!zoIPM|^Zxwu{t8%v++KF-TcdQEZr@}K zdE!ZiC;Se7GFCHQjaDxpG80K~dCPI_BB%BTKu)2@XC|ilWzk|t^${B;5EV;{^%;W2 zVVf=yDTYiZhq$nl#0Ms&CHS&4F@67`#rU(fj52Pt50{*De%?g+kr}C%SR8NS;0OOy zvdoi_LpZ`U0X5}$j$+)dL2ho20m{y)BJJ2cV&k=L;)!fPv-;%cJGa`jF?@D$YkiNob?ex0I-P-6)7MWq+r_&*UfX z!wl+azCoS$w-0yH!XimPUq8+4bakKF@S)n}M=_bf>;7_eFmF#Grv=x9i*-kPbnU0H zIFZ3&|NO#xH(gtZXr;5(X<_K@{H@(gOHzx>ddBT;PaC9ct#rMNr1-k=XJ(00HqVv( zo^yDlTdh(N;OULc3`}e^cLWtWqv~uHjHj?#PPe&^E|hCDTKa9&nXP(GC1Fb~TJbv& zZ5_NH>P-)`ME;~q5bui(FDpx1YkTXtp&HxonN5aq^A10>4TMv6Y#A zgGmg__oY5-<1z6Zofv~?g!={BC3c5mDheK~;>H%>!Y`>*BsRnVTu7V|1Hw^|u6sj| zm$|z;2Dv?(Z5|I#^18olu5Kxg^xc50fPErh0d=_O`@=h!@q3qVWP{=M^a}$TK=58_ zah)ZPXlwJtad%yCc6732XIwoHH0l9T9`4byqQ`=BAq zEwDbFE)n}A5`scJTHa{Pb_c&q(0YNxVJh;DavJ|fe^z(A$7OLC^3ldmX-YAF|N2sF zYUVM=P_cZAR*O)1&LrzN{q!X&YHpJ#*akRtmzp1+U}Iq?C#k6}b8&ETbG9~d7&HU; zU*9#H#tSapySZl?w(}L|v$y)yKMb2~QK1oX;y<-%(+Boo`;wEFtCnDY3mGW?XhF&1 zxAWh;Rd|XhdDErNdQN6|2XU!*Mkp9iqef!Obxe#h42_SDPasJ_@O1owDDSlpr|BIs zhl&G+DKo+JhFmP)NqBN~Q0hpTljj_Y9t5BI%ax?b%k=!KweT`1X}BrG1jEnuYg||f zpQ2Vp?;i6VYBoWx9Sq{G$n!9y{O*S6Eh*$f%Ho&b*USxR_sRRuX_@?U`NrWrtM zo~<+(jW(nM)NbuoiN zET2mMZDOUBV=Lu?OlJ2{q0ZfSL-WXJTnRTGf9XyvF^s0>}K4aMxuJL~*LD}hZcG{@tREFtgqSZepp8xCJK9$fo+mHz zjiKO+SOH_u98YGdgp`DkuqZhvD-rn#FVpaK^>mE2Unalj4ImCnWXRxaLA81AdA7%_ z)NFRxo{IrItQPCx!EFYkE&E}I6R-f5oX<)7Odie;6UJm$Lw$*GcW5LGoEuFp1wA#%K1NS?1D*>I?i{sb+$Q*84YN z79VqXDj&yNR60{t(tkU|gTM|C_6&_chF_b5E5N=OI;hba24q)ab;k<~qH9YZ*T86& z_6LSA(NdOxuJim@maAOA2nC0+E(8PdhlfD3YE6eQCFPu~k>;O|nLqe^ziNmDcETXI z-Cza3oele?eo3TH>$G9rI?1;mM7&sUHdt){$p2QWRc=72s1`Jl!R`DI9zqg$cez?B zcKO-pjPakckrvv=@r9RzpMym3`k&zS^P{9CE-oh;Cua&`Cp|FgECm4hy8iVk)AIsc zUcSfnr?I#A*QitUjn>n1`v>jO;puF-Muc-NxRAG#C1qs4dL`4FoEG4!gd!#I#W$mf zNlHp0grmb`fT8t?;not!1?1F!#-J#0suEn|jY3$@O68 z019=>nuL_75CALcn=WQ6K6boAN8xclPbN?NFDv2pUeHcKzv;I3&P7VjNz(dX$)Q36 zpUU6G_(KNRBdGpIX2-IR?jebn@=R}UlDWF;#y34nP|D#JZ|h+x-VUzRs7acgynwd0 zHa+se8(tMkF{7OnQ4TCscpX9D4fY%-BP&@10$ZG1L4hKP%#bfwVFm4yB8WUzq91NM z{2Jh8V4Je&`C4K5`Kj3HdkFqU^_qd%ARr)+<89C2ceMeE4`GK4nt>5}s6mgHD;GO8 z=93rr8jJKAEZ!SwoVS=jNZYbU{Fk9v;g?9@Bwy25-N4dlW^QDpXO>lI?R8i>kkX?? zE*!J3h7?@(pPyW8tisHULTvOcDJkU-uA<{d|IqW4O}FnhW@+Z2jrqjSf%j`kRnAZ6 zEhaU>nK@HqN#!nubkTMBr`1RtgE07wPYDhj|5P1SL3M2j87Z;Jsj-;`&qD&w7epK` z{jQj&aMq z^OBNNdjWItM1EJ@-b_G~;R5T#;ACoQ$|xK=<;F?D%?$p=*QMzHm6le!Fb`#E7-=hbyz7~?-yrei9J`5y{3X5YQ>Lk zE1+`IZu2}6|E&<=d~?6XvGg0&-^Mbv2E*>P<=XT^&dC%u+qq}~a6CLbXyAKYYtNn9 zkbsf!TR27rF1uDrLq!geEp}c>`LN&9_Nat{7o9YpG=vltKxhm5>$wKO2p;Tj?_{8D z_}>~*E?2&$Lkkub%JAv(=HXpXuiZg!UuNvS;r5z0)8*7~o@l1Kunfvib4!RG9)n0xh$O zA>wgzAmhWH0y`9$jG>{i@B4N<&B|Q&i_*lQY0+>eaIV9@%>0O%PtuZ7GGGY@@>sI{ zX6eRj4pJ%B9dV+K-D|NM(Q}tq%-KZdXwZ`48WS}eZ8X!zz zbg&q6IEmhJ;V_R_bgKfkQYXZ^e-x1eD*tHJDYwqV_Cg>m>c(u#4qNK)7wIPxiT)h} zUAnZ)DV$2gOAIVkd!lD&x*wQe5=yeMCdhTNSnZq;>Rj`gV#t!0zxV#qEfh!ve$G6( z6URu9kP+*{TgtJpy~Ecqc}uc#GGMn=NlU^eMDBzbu~YsgSxw**wZ;=keC7+`#k*n% zj&^6OrIkXP8@w$`tEy@#$tfDDNvSb7$&^e~v5t;)tn*4rf8&)xh)YpK65`_G6?Lhq zRPC7Z1QRTrORN?hmRC7zd_CHD)}()b`FewiStw5w!7nG-Z5wg9IT>&OV!4ji`4#U{ zFu4dL3g4Z7RCj*h7pFMQeUg~>e4=^pW(EEz{u6|5Z^A&+=KWo#cesC)fs&M%nh3I1 zg%%h)VYM@{FjZGstQKDaR2|F;+hymO`^ZFZVL>-5TZv(no40-kWsxWy5h+=B1W z&p}*m9kH7X9om-%;8@cAEN(<@Axg?Mf{g;?wC#R=J(3kie!T5L8p(sBZ4;IyPJb`zl5bAlm zq#Ud2JaxIb0>V}ze*{=&ap<^w?L0wcdBVU|FT}Vn}b*Mn9Gke#VR%Gj$87;HM=$KCSuL6G5l5w&; zZF*v5dp$2bFDnE??t=rt;j|3N(*5u>>7zqmo`G=bEAUZ&GOLoI<>TTX^=V*ii*w@4 zM2yAcF)`796DA;71+O5essZ@Pj=nyiF;Y~Bjnm%@3hHpj#38^Y_#&DDMCm;rcH$ck zce$sX^NtisN#j zkU~?_lvV%&XPTPQs^a3&6R=;uUJ1pFkr}ph`O%lE>_3+`pqo>sZ=7i7PR7}-WC6z+ zgx+=j?~}!?biygsPeTSrB7Wk0!goDiQgx85;_fd~=FuOn4MzSr!PC$Oy-S%Sm3iog zIV0|wXH}*KB?8`7UC~NmT|pdm6ZHD%t7{r5`py2c3&-#2p|3_UQo)}SMIT@BrPybh3E_M?>lKQ z62rpI_BFLNMPGXpm<*-!3;#eF$1xb@37QyCkBR3`6DL#Kk=HkaG&F>+Ae0YNREwVa z(2j`0+z2snaBz^(pZR!>#-*$ounZBC}-D@9A~_giCL zR=BvfkaH?a%Zm#{OAJ{Z9dBe|N(@|!V$k=D@`6dFV%br4q-$C4oMN2MjLhjM|%&-2~$ z{rj24!NdMI_r|sL3T?+uKzqE;Jcw|<+HMb=17Dqh(5yv(d#*}@)I)>vZ)Iiqzz9R) zvG4tMu&`GNlr{cM{{9g1hPLv0P7$=?8m(re%>!b$VXY}Xf7>i}nf^8Qvhx!zr-Pe z6M`Wj1K_{?+=Z;e-kfpisMURM##s~=Q(mA&oH{om=L^CZv*=|w8V#g7cmo=Pf<>vf z_SwWxArmx10n1c56MNRbNDF=EK~8LAg41MYbCo93tf70IS!Y|+K~VpZkL;4 zqJx72ZQhRym-F8)6FVy3wOx71MQU18U&mM3E3~-m-=;cvTOSCxnyeQW9BC5&zakxQ z3*`TPxIIn%0f&OeK3ZxNgXTUg64ln4Q85!2lEW0QX-Y~e`nty_|MdKn^wP8eI`xKy zOdJ3q_LW&n_QpTsOp-4LD);GR8cn@3wU|o5G2OPC`HQ^K0jW`}yJF>F(=G zxwq;DKdXX>>CQNA{~`AXJgq4zSw&vz*%qb3mkQ!Khk_Egbla)FS_+!tl)jj%6BEOb zH@7zev3ixsP(MLF{KjVL80CrGS;Eb#0Ic5hz||X6rUt5Kic5j9=>(5Tdh`q9xaOR>`qm92BP7DX(aB-9H;)l1_=#?gmGsPI6=XY^Xp{wm9s^!vjI)^3#Q)|k~!`8vaUZG%R=E6Uys zI?ZnLHzM{0GC2HBeZkYh3D9?^)6E9l8r-i==V!Ds;qa?Rr}d1av1Nch3J|On6z4-e z%h^c^;nY{)vLr<97SgG+BTTRb;aUw+apQBHJHDhO2ymI^AWG?wxoXq~M)+~PnygCWo(J1Q!|Pghn9;A!%Bfcf?i z?yiD)BbkA5y0lEc7pbEmS+p4vDiUp zO^iSd^K!mjDhPPEtE-K*4L=x(_p3XyV`2bYS72aZi@GIou5TKcaL~x;uw)2MnzetT z@s#0pLKC4ELg)Q4lx+RWv(orMC`Dsa!TOUWV%!N;*68deZ*$vgB~1JHJn8c%jPkoP zGh&Q4n%8SOBVlUpgc=3ct`*cxZ?N;K!~V9=;(a?r#~Um(G$tlHA_D{9sfUviQJn0W z>zP@psIB!*4^!WGmX`&G2JmQDKWwhDvU5cvHdlYT{=Uy1&^iMz!%^{4*Zt@ybmUck zjlWoMuDwJXi$Am6qjstwaW`p=efH@H=wNtovhNRqZHb1Tf%94hmN?H-FOY1yoXOb7 z$H~jA+9Z3B#56TCCT(_h>L53$`}J@sacM~Y^Q5BStE;M^rK6$XEp{&kJ&cjb!~I(5 z#>!^x4x8cm^OJsN0KQ_kTw{96mPmK1LhFTI#OvCuQO zgk)yu+Y#AN(2`Qpl2AZ?f380*EQ*m7ATA{_^+tguagb;eYI!w+!jy}Q(9KWC7v`z9 z$u0BAitk;9n4&Xm)|ENhK)~g=eNu0JVU;+M&eP)k+LB*8$mvvXl}k(37gQ2zQ!MAb zQsz1m5pTQcr&da(S<)R$O!BW*X8eFNG*% zY9F)MLo#zH3nbPKFDL%8odEZ))GT=ZrcXG_R4dV+_9aF^VyiW||H+D+d>SeADXHl3 zk|bAuS3kGM_ubReL;Iz}bNBUT_}{yZ?ZWAKEXK3dsmWp!u%IqP&?Js!@*1qv zVb6Xh{V)qQ$RyC>ay$W?c%B;eioI-ZO0oBj;TPzu&6iA?4HEH93V;2=N;jO9vpnu5BQ~1OW1s`h?>B~3V zSCa(159G6+<|=M>2o3B2+?SCNxWcor)SH+aZ|)0EH(u7w8@X0}j25Zu$s(Q0r<215ft;Lo7t5t8l?1?$Nj(J{ z7Y7R~6$|&s7cGuLBIQaJdnQIrazs*+mUBp)Jd_q(Hiej2IJVe4@jE|rtn@57$A_3# zyQoUX>VE9`!Ibo2M5fQr&0V5rolFDQoiNY$AE=nm>|4K54wipW$nc`^rVW`LD~fr! zwyaf@%Y{}vzM0vk_H_4;OZkxl2JC(G__;C+=qeR=J6T8he5fe166!s0I!_YRTzR?9 zWnht(l#=u}Ek)2i3;==Me)~qGnw$1FpH(m7ei`H?m3o>jI>+B?WHcXyQ!5i~oYPjX zF)?=?Rz4Q*$d<7@t5_$~+V;1?MA3S}y8?iKgk^g`N)#Erc$08pho+l_CU^J$&3_9WRS{EUT!lR^gq*2G?ShsTl5M7k7a$DO1YA>ic6<&q^dIq|SyNkHD`X? zN1Aq2cYHQ7@lXJaHx5&?VW)wqTXc8V!dP++9e?ye9bXywlLC5fX6dz`{ zSQHApH|}it7r}i&0z;OUC!T?|e4$%ua4KuA`_9cR^h;G-6_~n2=9iU#+PP{rxGe?x z%r_T5y7ho3nv-L&8#`NTXR?P*Ysvn7Qf6+STD31wKZ$PktmjEcW?+|s^#kr9@#pBM zsRGCp`^iTjT7)mjd;f6X@aKbp8;EUPhkPGU8mo(feyb~Z(7KKYK*#GTKF2pM(sZgY z@Dgq~b=qzB1dLVyF#(>sRioQLz$;>@-e`C1s|K{v3Avr#o*0GFUmQ-?rYE3qDlNzK z&?Hq2BUe?sKTQ@8)YM zG8o>$gn9%r48*U~lH+t#Rh1OfwXgG`#SN62Ixck|BDOuzxs!7Wgy}2QdMXsTz4OPV z{n(0Av)@be@*oD1rC@KxyVKIs!AqCbrrzUY6JpY3aub04MSPKirlE<=Pakhx8=I}v zL^+;|wYCd@tag4{aTtleR%`zX_#zst)f@GP+prZW0ECp|%+t2t%OiQpTD5&*q|?Gd zL7;FPd;}c)%8{8_QAx?qD+qTqSc?k4zkAff>Z%}2rWP%4NIjf())Z2393Q=Y5L`)5 zB@YdC+_3URW{5NYb2EVtd5=F>HSt^k{$9aLR%EOKq5PrS|BdNrz2Y_R(tp3P;#LWq z!!!&1UZvu2G>ylXIF<=k(k!Kg4He)>7~0sDU7_L$jvll@P23?n1sHO#d{G4^uv zvq(U{QRWRLZt3(H`Uw}8*7NXWSV&<}Ns(zM=x#DLr67T%0t^G&38!n+uF20|MKl;1FT%?%iIFy8o5T-Pi0pT^@kP0gZsq z+2(zCFz-#5#_zs>cbGg&9>>(IQ+cuO7L8NoSDv375(7~5s$>4}Sx}W0n*xB2qEgCg zv^^tJE|PI63{=!OU1R2(+b`jywUEuvWTb^RK6H~cr*Cdd1eP{RLdQbUZd<=>xUiP~ z7L}afMVX#7_4vI}&J>?D{YsM113X`$q{@VUsk)LtfqMXR}@XqgG5Kt+Ah zptra%Nr>~yI4LnFU1u((w&*+J4!-^EEs)eS$wAAbH!dh7?-N1YLDA3c_1k!Iap!&X zc%FG}9;9m=J(LAdmltQp2Ct2ln(vP@WKtjMEjAOGsG@KLM^la7pI)9V&Sr}XYimn= zePd%wNIY$GzyhVNPL~VV*vJ*ep__2!Ci#;>2!@0Ne}%oejpJ8}GY{SKK4E0ANj_w6dUfy+5ga8Pec9X0aXjl5{#gWKU9+*1 zpGEPK$2PJQvQL%eec_D2;$La@@gro8E7ix*538Pibl{ZtpE|CX$CqAGw)O9~+I zNeL+{tH}e-D~aSbU@a393)J{yb37M&q_vskjkL9`E;4a>h$>7$s~a1FsPWhW9ng&m znd2Rs*l6!*h_)2aRaFk6UU=M%DRes}edFZg5;*(cXT}B@zEe_{=9q&Piyym?cMHZe zo9sq2ND3L6v^yOys~hFIS|6twtGBe1)6&vnMTNp z3^$@B8yeV40qj{$c!)f?0&GPJAr>8orJ-TJv?h{gk31b8}2typ2Zp!HIw20F6$w;Wo9| zf;YzdC<%ig&inJ}{M>fWpa-W04Dvv?7Os_+7q^xb9J8v#vb>U#oE*SWVZ?+V82dLX zeenkj8R>uKi>!XX=uYh;zKhdo*5Lo5!nUkXBdyvC71FcyfeM8-N+LwIaCx$*yo z-LIZk1Qt^V?u!(#{TFu=QV)As6YKJ}51*ZpGumV8S~*ug^6Lm%vH znY=I$DL_`%ABBr9!Yl2sv;$J;{N30c3uOtjo<)cxdl|h@o3Ma9vWb%|Hdc6iBFY~S zHAr1t#p9_i1wKM6^Vl{W@woAqR>23cLs)ZNQ&qImC=yt5W}M82(TxQWI|U6L84(*B zJrNZn8#T|>eJN&@|M~mdbh>(TviW%Sl$Gu0h5d#4e(32eQ_e-NBnJ84&S!vz)DuVn}dN)8Dqh>VJIY zkEB+IeJ%x#O#9Z?xzqT}%FWd-!1!I%a@I_fmzQ0UCcmCYn}et;>$R5Zi$_^|M>px?sf=_<)Ya7o zp2E7?lmzs=1hf(EF(oF4#N}jyT?tXpu(0kfw6;zYf#ZM2h132B@Qa(oUu^^jqgnte z{Wq1avlJ2doQ79Z+2Hu@s4`aOdLT1^Kw&2Amp#YYb)&AV77|>Y1}31LAYPM1X?g2= zZ|=3?0$)L-gB$q$>rBfQ5?itpRY_5I_u)ucp%iV3BasO3-C-nnZX69K*Q- z_)besMN*k#JfHtrRDAo}YHg?HaR_@cm0+WCKGL1?M9 z%ctwV&qgmkhPF(8*SDwPIAh>Q<92tn?dSeT=*HvvwpV;eL#XrVvsLvN!)SX=1%QB_ zAw{-menUyEu&|dzULH8VRGo@5JMQI~FZYXN-6MU0S=afMABV$BL&r$Z#zoG>#z)T7 zx4C#aY=9Uw2pj>LbN~p@=LJ6Z-bDF(7#Us`u9)My?E}<=Svdz+<;~T9 zfO~sFLq%j{WI;-3O%B+SD^(3z(ibBMDi|0>c|9z-gV&tVQ^F4|;;%RMTeDbI`$j^= zyUNRxi7Bvb#(qcwCjlCvWE5+f*;{+t6g#w~S$U@Vo9;__oTESnul;aqnmKXpg2(M) z2S7gYRc=B+p$ZCa1|a!@Z$5S0c|9C$x4-_Y<2XI zs$u`=k(NC8+jlgT^ zdc9b82mEFacMlIY9^2u{mWd&q|NGB2hI08zrW9mPx;2? zFe_aY2lMdHuY||q=70QB<$kIv394hH^tf?Eq_Mbf?~r+ytG4T%R)CAiX7D+_oIQ_L zSXlu)IeYu|9e@g$e@lTtxK!)-UIHvJ%b(1r-~N49GgvHF?yzSIWHZm(jw<6*H6I9g zTsO|UZ&ki*GXn9aW3}ezexrTDqgW@u(M3lphWumnJi|bkgEt=WN*`x6p#3ia5EiIH zs*x|>bY9!;ysk%HlLymF4=3^XJ+8L8-&-5Yw3(a-2vG-Rl72WXb@8opudb@s*HWG0-1)na_K+YWZ;8f#g*cRY9#X2!~rYz}7Uw;ILxDYX=nzIWZPqJ7q59RncUQ zowD+a*?!H8odO#s=H6k?o1K7wl@&-`5=bF<=-cVT8H%~`dOy59-%=o2Yje8aO!566 zZ*LtH$J6W&Lm;@jvp|sGEbeZ>0t9zi+}+*Xo#5{7?(Po3EkJM!B>a}|^ISXkJ@?NS z=IqXNcU5=QY}d^6)TioZ(ctkxjt+M^gU9|ZES@3+<>yL6VpVcmSy@?le4alEvdy>P zELrT7&d$oDM*2ia$lI@R5agrA91gn#909Mt?7pNUYdT#`pN%fQ&Ldd(f747uKXf#j zVe_OEZX6KT#Fq8L?(wTF?2J$)RIYf)=5aY+ZF_gfe?cVzdaYieQ%FWRt|Ns z)_8ja-#UPo#-2x3$xymFoNH~j^SZK|+E~y*3=G89!&Zru)N~~P1<7Q}!Bu}Okq;kU zJI|#LVU!5bp`Uejc8*dPf3o>3b<~r-h1xaJI@64sg_PjodpJJx;xy$hfmag zV|R{@ijInsousF)vcBMT`L)<40}dna`AB8BRiOs<#&37NSe$OJ0tf2$&-3^9|6UBv z6xp5;QXJzC4iP23B8+)lwdJ|~C$B{BtFfVlJlRD(V+|{sif#^hDyxYhsFA4yZl3Pu z1_ANL5vYW@r(gcho95Y>m$k%DlK02CHXnS6LhWYjjb`_Y`uAG`LTkGnK4=nF0U7X+;iI(;Wi@q6v(cs>;TJgosnr5m&ur7;**v#6r-ZIO+=>HZE`R_;9vAVXzkB^Z2G zSyfd<&%hvu+`FoTYySbqb4-qqw8&W4rO?R*Y9gUa!X8x6XveBD!`?RLg) zd)Tihz#FMC9QCCC%t-I|y=Jj-@vbomoK#iv_9z{jVCkF0dBKV7**0UUg81+)cz zp=A1(+xz$8HAUKYCQHH%@GY~oQ&ZF8KT)lBCIQMCsuB{K5m@7ke>MHO{HE0P_Knbm z{|xBr!8_1d>(ZqsZ&lQpTs4j!lfw)~ZL0m;dC^geE5D&mZxyUOxe& zxPP9Smw{j8)ER@qXl10s;1S^w!XuyuR2k$6$k>W$CrA0=%A2J$f%91*^JnXqI_ zFSo0r@hzS%DxwT_kL%7#&B;s$=N-hy!NDQG!8yOYeckQa;M@dXo_AfY7yWe@GncD$ zn=FPB+E}S#h|X6_)Goo!Y>k$d5@H&XTB&>n`t7yYqh)lX6C%a+aKdR1o-DssP8!2s zOLpT2Pl{%CdoBB!V2^$6p#lOCUz>+00UN?!LIBh=O8!j-*dT0`n=fCLl&C(?Fj0Oc z`>@{|ATl{!&OIuoyUx+wrrt#1VxY{?2`$)4RF>@SEnX7T1v@6`7;ySEIdE7Vw3fc(%mS zlTb!k*^w1Cjitt%M?E?l{Kt6krRV?pXDyu}{Z7WwRUr}~yAHt>aTetB^&m|2pN`H_67o9N={ z117q`$>SbWhn&28A_CdZES0a?;0J*4#qLl| z{2w@p9^Cwt;Z#hL;?U0?{MT-7;8dqCoH{ck+dc2e6SX*M^xE7|WTlXa`P_1ia()q8 zSCvkr#w!vMgIA*|rPQbnfej%HjEoX9ihjf5bIw*+Am}ovmbuf-SW=^5eIl-#GxEhh z!Y17-L2o~lWl`iAZPKdBS(2&juCK0cFvf76?mqKiyryF^Xk}xoIBjstmN(RA%PqEr z05j-RKE&wN_GKj|e<#8uAs{+1EK{Ltp_o?mxP*F6qza6^o3mBDs`xf1A@AIdO>A7(F0VNT~R>0%FPH(4U zG$?6uGaz9;VGqN^1Amh1wthi*?cPB>cjgv+Yq{0!eH?NYjQP@HtJ(4U65E$4ThQ?) zjg0y07Gh9aRd}9%cXf<_dvFR9C5}wIP!fJWk$EQ&NlG}1g7d+PZ1iy_F73G(cp2b+ zn|~e$v)i(Hgze^-fTbJkLw<8Bl>JE8c<0`TMs&V%>08d2)fv!ls8ml6BJL0{%31*j zLm62(misDZWvJ<*>*Hf1@8aTu<32U^9zGQg-tA?5W@hE=ns~*L8U?&?X}Vo4X9-^Z zWdXKJCS2`Nqvo}gVO3^j#Vp`xC$N}}EG|dT*>k9$S8_TdoF_8y&hAZ`Xrc}W zjJE82CGK!`hwV!dh~CDQ=UwTHB^3;r#2%2Dn-Q&@h#q8%o%3SwCh0*U;(HAs$C$52 zusC|R%&i7*YiF*c0^X-@j6i|U+~8+&D)0jqEe{XR-quFy49RA<&(ze#cpK(RbG25T zS^RC*`wc4*d#NorZuJ_YUI;kuZbpWtW(IRpB@Gi39R)QtV#kCbdB4c{0gdkZ&5)CK z)15D=un)Rhk+{}xEFZljPUh~dnhyBJyRz45sXL7(`zK#JgN`;kyW4BT@GzP2+Pf+b zr0-m=OUr>HGujS4FQXew%rw2*m*8hArp~S|e$wp@pVP%%eqQZno3&Pxwb#=`2~<*! z*|D-7(Hh2!-2I8(Sv1*hfT4!4f6-_FrPXJp&yjt=2U7;UlVI?=iDf{+2rHEmg?E>i zOwNQYGOCPpDcGRm1{7<O!XtT?C>wf$Y@p$Gt zx8q)KOf((N%=hbKQeRmTPKR1iaI9ExRO+UNre+}P?9%+KzHE0A)`4)+DHg7=Bs>D# ztjc*tG28iX5wyalK7MjP#pBHZo;UH1C|^`8KPq7(wlIOnIyU4=o_l;gkMTQ=+rOF( zbD-^b3UKU7FfM981R0!0LZjR6A?Y2Kd3m<8TBFwTuzW-%0TaZbFIYU8keZqpsD|Gj z#31_@4iSDf8dOY)>`M(7(5UJL^TPZytBr68-<+ShK)ur|08PZ)3bb9N@CF$uDW3-P zo__rZcCUVAaqkbhHW~&y!VK2gwoG4atgWpJcUeJ?#rT2OqOzjEmuIeQEu4>v)y~iT z0#@L)6+xm4?R4*BGt;#c0bJ;3XxRIT!vl1zn#FRso@FN*dqVI<~lZlGAIkA8Q_0eg{r2j5(kN0gTXWpq<4 z>T7Fj^>u167mcBXefYWVQhvmKLEt$81gS9>V)qYG2xYb$YDAP1@cfoA!HMHCH?~?V zj?NP%^d?3=c}|E=NJ>b;!Yz_p-CUH0X2%zf(<5X||J9HZ#eUEygFjEOySIyphJl@! zl#;Cc^_%L#;@rZ*%EI#E*I++7CB_LU=`aMuD?~WIc(_rZCnVv}I|pJEGDWrduUDcjIIUrs#T8@ObqfZkgn40&t7m zCVMm7e5nCVU9U6TZ2w4CeRbENcYkekzwn*GoBW?qF6K6$d%J@sMd3mwKyy zwi??raZjfRpn?mag)M}fCBR?*e{Py#Z%{ug5=sz2HpY%l4j=>T_dQ!f3j`Ks05jly zhmVixo4Xwdzyy9KvvopXQg$|U`sY~I+{O}tNdmxzz$9YpU<`5qXuZ=g>mV>GfsC90 zS}e@0j4a&jV0QxmI|myh8#tsq7l4f$$jHpa%*+K~=VE4LXXoZ(0TT!V{;L}!Cv#gH za6bSh6(wne_YVM#nUj;9BM%dkBgnwf+!*BO&R$o?qq0dYsqMC`yVw7|E^*J z=V35+0x>w68GuK|^cn1LD)678vHX{466RJ;;E^*)SQ$8h#6U*2#vlYHS&)sXlNoq` z>;eLSf2+kUt4eh{c7YkmXGSmHwD5LsH5?P3%zm@(IPlArj~z7`%HZ{z4A;f*vQAfX zpz6<9w>m-Jzb3fev$qKMN?gBRs2?Z%3w@k@SH$lwUTg0M25t*Bti}ZYx=b-9^BaD8 zdtKsh?Z8CE@IHWJHyN8!Ibrx|;l|b4{%iB7%Y!!VWxy2`pVvw+dAq7Op>EW|EYmXZj8l)`&o`y;)In{&h-9Av@QnSjxc?OFNR=yvISV&0(G1}aGoisxkZ;Pu zK{h?zwys1X+CJbFd&o)Xqo`}u_{TLUNqV@^RGns3W;x{;7X`+Z^XPnqX&6d7U4;R9 zuNh zO7gYEQdvU+SNuDcF+F7s)Pw$2VlAjkK)@zufB zNErm4R7_vRBmhj`KyFR|CTVMMLy>=fi~jpt8a$oE-JB$qoxs27cT!1K04ul$B?Kl( z4gkmd9(XD+sVf*-yw6f_19eUS=YJGS*xLM4Ccy?^`xlV}JAnOPweMtdAY*d_5nH!^ z&2@0PSO6Cr@O=Wm8wbbtIse`kTp$W&1hN4afoK0eohv&zI2$>AHE{T+lo^5PU%LR7 zck$nc^dE-j|5F`~?;M@MV`D*Jk})?1_w)~$&VQqO7xLc*%Z$;S*}|0*oW8=r){W)g zZ2?T`8kzu3Ab^we-Aes8%6Ccshp7`aa5Av6HGLnWDOmsi8X^Ld7})TDkN&MqRdbLl z$lEGw+U#9YZRe@>E9qp_P+{J8-zL`5&fdF7_fc}S3dROwl2k|fa!vX*T zIoPGSJP=EM?tTPf>*YK=I;K-d)J7Cdz*$rj0=Z2A+&+LdW7D;~J@Zp3 z-?r!W%MZ@W%x-SqY|UR~<;o@U3|kP;5K3rbc+BmEPFU{gop3@rX#~VN0tPpS<(||K zZ~{@=oE|re@$G`rnGjM)`%qM})6*JTzAG#0-5>Us7QPItByBhDX!!{kLC|x~=xQrV zzRasmN`f)QYE^KXXD=J65E$di3T=fpzxGxbD>f1ID+itu+Su=%cRnzTGY#I{Y>KDq z_G^3EyIC1v{cMnILVX{^6yr?WD}!uv(SE_eFMviv z%xNy*=_~qMAzlmaOn|<-ftNA^yd$D@NF}aWf3qi*J-le$BT#9YK!W|D!}v*gCk_uL)pXSI6T3m1F&)RE}E?u=~ZcoILj6@jeM()0FrDO2l_yE~8HQ*s`%@7Y~8&9V#IS z^DilZV(ugRRTKE)21QK!>VXenWk5G|(e^1Xj&(vafvaBR3n83uV0x=6|3 zm!cDSN*7<#xA?uT+9B3(jHuE8AOLCA$H(|`+=Ojp#eIWh$;|(w|8M8Cc=+!lBjj7= z8UaO5{>v%aLGD?-KZr-aeP2Wob1zzwl>dDE^(`HIK>)bm@OU)!&dq(qTBq#$m* zw(E0vC-MPPZJnq4y-}@y5k+zq1LF2X?_GsTM_=@TB0rK1OB5X@O%9p&bpQ18_%VG> z@LkT6l4Sq{i9hw2mm9`I@9hC}cN0|8@(16K)XPq|+K`+BFpbNnX$}lAXP+APFj~`F z?Kw;by3D2?`vvGd$+SOq^a*Q^P!@NF6?uIPerUsXN%R6{ z6jzwg>?e7j^!)C#Nb-PX8({R(+>N!1!}~^^1e=7p6GES5Zuyn8CebCY!N}Sa-9k24 z^C#lRv<9rd(7ygqpQQfErj{d>6RCW==RLH(%YZVVZGJHDx>dd*?n206@1NMC0ezZ& zakisa;OK-VMMoW@!W?DWbfqtPgqxV_Fu7jif<0bnvg7^o7AH2!Xp#F8{4z8$M7mU# z9g2+^BZc>C(D`L%FpM8L&g0JfG9lKSC0qKkP%Odb_E~j1WeYBnNd0La3FOL;`^dmn*wzJ z_Z;9Q+D$2_W;CUGzaRA?swo0mIpjKnH~)mZE(?QIdVUa z*LNHN4E{YIMPdHqQX3U(W&V5*?fcH3LF<4&x=nA&;uPA8vAD?ze@nzRpW#l&Lo*J#OCRT4q?lQ=6vHAIyC2kF zB_iu4_awwco`vDlFNyA)uXj!vG8D$8nf19E>k?fMQ&4&8YghSiu_|RIRq)C|`5Ps2 zLWs=ayja4{k_LYM6zavagOU^@Nk>5Mg`_qh^4paw7xisilCr> z_P9_IWWNW$^r`OQAK zvR2V_M46<_T+-ix$m7^F*XU2s90L@_I>(2tDaE^!&v8*I(fKbb1xY@Q@!gWt3tFBr zOcuOi+E)r*-}^`HHWfG`d;`b67FsF&5I*}ANb-P^_7S&N@%(T_eE^S-;lL%PL~fiW z59P%Zj*1qQ&L=<6eVjZEVx})J0l}gWF2+8pGyG2%k;UmJQ1I6cZqoZ&{3bMU>ngD~ zN9#tnpGoL*`Mby1D1@5K#&$lsHq*V3Ykyuq;=q@OQ(_blv}Y0Qt9h9~&B%oV&v`Re zg*ZoM6ik=Qo`LZ%N&c7fv!y?W71i&lz8S6^KrBnFsHhH(@>BwQ zJ^DScFZHZzlZw7E!3{R{#rL^KBbM8n@kO(wIcaz_j9^+TqXd?)&2klyr;*Uzz|dKK z@si^(%W_(icV*l8mA=4KA>BNPync_#O*`jyQ>; zFGCx!T0(|o5h}EQPNt3|m<+ugG1Z5jPP%}j#yKvk!Q&}dj4;+GwBO=~gU0uuGLw`c z7Qyq$7cmOt;xN3(EI2ko9eJ6A>V;T>JuKbG7|&ZP z{d?!c(Yw+lVSpoHh>S_McMUOl!y(GXtAt;$L|?+6Zj>|bK#;&~s#}ASPuX&%)52d2 zpYzN*5tB6UE^0JrA9KF$=CgL7zczS^?LR;KGstG5_%3YdHZ*HY#;z`D51~&6ljt6S z4>#IjIK7`<$sjD8>{Z#Z;QIot`7EtF0(?}&*pktndYO#ETQpM>E%mAv--!pq+~n%4 z)XY;Y$u-FoD;vV9zBcVdv8=7t;{7N%xsjTi54lie=x6Lx|2;g}p>+KI9@QdmxPmXX z^bxdlCLd@2?n#H6#RmL<)(a;!$^KI>kyl`8MTCtMWl?EUX|6(G@)63Rwk}#gA;-3o zu1cOjzM}qx2h6?r%iSMDwB!OG?D5jg23mxS5V(DV^w5>1u<_^GU!wfuy z$Q!l?1A$_v6YWA0r^gi^!)jyUEL`sM6>sT+`et1}!?;|)i2M?kYfv9; z&k#uv7Y)NTQX=!PHsmq7Y{9O{Fpkq^Wi8S?WX6|jwPc$dO^R&>F3@hqQ8HezP4srD zBXK^xVtOUeo#RHQar7WW58`m4g8#Ck5 zr;71bDIhkUWjR;v2?G2Nx+`tQt{Q>2+Vu=LYld_F$zu}+-Am4=TI~GhipU(jOzcm=vGamq~rU)54N$f!GVvT)?qzco`Oq5 z8JN|n8Ho8iG!Q&qcJqaII-S^&)9bX}0pn2qPR#;Xhu=XnV4e}I)8p5VrK86W&$2s4 zTj%@xOBr6wrFz?7rWw&)?}V|9Y_^&N1Z-y}J>RMY9BGk=)0`RCbXY&#R%Vg>frD0p zf@CwJ^3(_PZX*fV3s1kxbiLLR&fiXmaE}nI1Q=}BKts6Z6#c5ocA#C~QRz0T!TqOQ z639A`o^IweSsw{>$Gu2rcE7uNmt?QM!QrM|^7rG+`S$k5Kk3_qTRnol4T6(+Y98Qj zRrzizvjTp_Z*Kl=YttPCp;&9%F#59M9?5z|SH%*#@a^y^bP!Tv1}d-Ba=3d^2aYq^wDfVw(~AvQ<4}+{FaR{5%V+Vju^L zq9q2)y=Lrh=rKsKHzu9qYCq-Jja_Ef&W+UPp zUYW`9@f1Wzy6URqqmIZ$g;E}mL?TDy5~krQ{1OC`JWNM~E`ODWLUbO^dH^Hx{Ii|( z2hPyoz0oIwa-mikSII)e>}zlo!V#9U@prSVJ)zOVgg$<7?5$};EL<}i!_O-~;73ut zTBtd#b3@^8UN9b8gppZX}}8`n$AvaNaP#@6jHzFj3|nMmcCY+#6Zgre?^#GLK~47;in9_Q5Lv2 z8wLlY{zz4_5dfblBzSkhlpMTkfZzaEb@$yA=?IzHB+@WXsK(8}l>pK6Vv;^$L}4|Z2pohZGW+`MG-tBHK1-0&InVLL;%Q&;Gy_?kj%j5gao_q z6vP^(Eu3eD)TCz)X#Cw89Q?6<_}1sT_!eA~O#ae#sqwb`p^Du6p(pTj?Bz|*MaS~n z7ncecu$qC_jr*Re-ir_ z{uq7L4Yy4Z)QknXK1X`tz98-w-K_C;yh7E&$8%+dM_-)nC&MhX_Lc=|jdhx(I8}Tj zlZ%6q=2l8cVtg+8Hb%F`rW#$zVva;W{2gJ5Kv9%Ex2}mcv;h4fyGL%ychTR}>;Vd5 zdIIZ7?eD88WRe+;Hbfm(UQ~)4iS)SPMMIvID!|3Up*H!1N*73UxO#&qTZt+n zw8fWqQvwtzdmxtJqny08`JWb7t3Zi#hOtGe!wz@_g{mn-e|s6ZHbyxQ#LT4$pK%ds z>DGgG4>ISa>2>gQl{7S#zZ73PpaI_c9n4tX_72%vnHwC?W($WVtfNyAcVE;Q13#*x z%v6x+G8Qh~IFK70X8dIRB9j3Gy5XBb{B%$EFwON$?;@keM7RdVz^qP8oIA7C0_%1= z!)8Lo=e;`NuKi+huhCJNfK?SzF8QNPrV-i`mKaiM_@(PwY1nXVQ`NGY1fdnCQ{PAWGuG8XwauS6c-1k?2srj} z>rHFV4f+zO(iC}$^35e0n+x65oz%^1iwhl&Pi{K<_2$^ck=6grS_wcXnsF%)Wbt}3~lPQQDw(M*=2j+Fu++Fu= z4$)^NX^ld5M$^#4LHC4nw$Ky(+(Y%U=Y)P@DQD#dr$4q1;>A*;#!_~q!Yb7@dN8z$ zZe{j-@1Ob#vFXzL_wmZ!noy6Dhx6Gf@97}M4bu}R48<`^)Yzmkid7pJheD_p?tag! z7V&>yCB+P_7Zc`Ejw`~hXRG2+ygJ_R0ixqHXv_-bY)R*v8-H9>L#S)4|BR*6mo%ty zX0s_%cbM0W!KPaV37!2_Tt+fDxm>Lzg3((ichU zi!u{_g>T8j8N{k3Uk7}gi+Q5p>J2%8=FLaEW^3&W?}XhP_3R5g*-t~z9b~)uEV#3r z3bym;3-(4YPv1ppIx5ARly_Tw{PSGG+(4hee|t)AtQ8lq-5an3<&R z0~L*)Fl7>jyd)nCZlBnJX|M4hZCZdE%Sbx2$}>i}0f8a1b{H4pbq+HjE&6e<)1YQ6 z+%-m8o)@Ge_jDlb;Im!b4L7}?#R0B^HZ*%!qybJblmA+n4EJ&$(IKlkOjFo|0iz-R z2sX3AGnQ(<*Pu!*#I@3(f<8OFSSJz=#b1;ZfbR4)f_j7-OtmUJ{gD*uH_A_!=r{pY9;V746;#QEb0uSWd6Npu(>6;LMKS4UgCKHKH5Tbf8`2MnSAriZx`F#woP(G|Zy$XnUtxZTzH$f@>2Uz41_Lp4u# zOg={of^XP4f7fQbewXz0m5}o9FQh(RoszyqD7>Y;+{OAHEyUX8_!MR;2=;sbM*p=C z>vVfc`e(9)^hn?j^W$mg8HoWD6|3%=GlfA#*^CItS} zypcXRjlW%!zRbn+`amYyNVf!`tqStLdJ=7qC&|nI2A0wOdEB(+^ zSoBjwk>-(2_L88h;jIiPy%QIe`IwHcA?T%m4t9FOqVzceG zK%T>PcMi#q7F5u7U{zZ6dUS;Zt-WLwq~Pb}C#40NJRI&RBm&cl`87l4sH})dP6iKt zQ+aVu{HW1jD9ycCf@r654!}ehPXqqkkg{fS;@l6IK#%g}eT8JXa}^EK!4+euL~2;L zx0JN5&}GN+;I47}2M%CKo#wRHN`E2X)*EYEvYOU<73uu2>?vAJ#Q@gOfLzl#N+%y1 z+XV|qz?J({e*);EGhZY~mRJn4Xqf=Vu<4r4W&H`=v}NE}$OYY`W><_^0pC}2U4$7r zoq!S#7cK_8Zbv!Y_H8Tr zW!ae{K7f#vNS)_bv-p0_xtCni#&;eU)#Jaoq`%I+8mW%QgrQ`5+)frQfoq(*P!NM# zrJnEtQSD1f=Hh#$DQV50VhUBB{m+Q8uS6I7xtb!(_4dNn1e=**8hoQP@k;W|^M(B1 zKIv?HIdg>(BX7pIiQ*A5YZih&$f44HsTx04G6IqnzSH(3v4LrYmJ%(qFQ(0SZ&$_e^2ZWf zc-Nkm;@mI(s6@3H=0EVMoMC)y@YZ#@yu2;`6DW{@0V{2!YGy!OtBGHZgmk->Du9W1 z?D|_LzH+kjLmlAE%U*VwO%8N`G4(o1I{-647eX2(C`KQ6D=U`Nz|nY?xhyR$`yVBbLi#sps^?xJBxYl zktoiW88emcJ!e*`a?>(=azeEz(xDb^$Ak*h^v85~z{o~&JkeE@s)yp@A}@jgHxV2v z+$CHEf@bmqPGYz`atrMxReEBF`qHjHJ*$N*;t?{98B^{CqLhE4vpyN-#iAW5hQs~% za_#)uCX}&bPF!}KWS5@YpP%IHDjTit8|wJ%zLM64?cWI1aTghvKQ{R{<>V1Kri&~A zEo(e>;tGWw3bcob`lO-TEHnIO81fHQIVz7y$v53#Yh{Ofcw=T9oc&62u ze@Za3slU}Z)gwWv<0w@GcJ)8I2hPIQQVXJX2{AP-dU8!o+2^L#Zdjw3GSin*Vv2L5 zaz}dQ*~xDN5YI$clP30D?Pw=xwcAgD%2-wspjK?WDz%q+Jo%3ur#kGF8; zyF7lDj;uuM@%}IYdH_Y*DgR7YXdh|1=x8(^1^lg0cy0aFNp=t@Aka3`dd{+hE5~)I z)GS{)vUVWpOJ2a_OX1O1w*y#o3 zbw>_Ml;weC+Yu$8Kr7C03k2O9O>&-&nL<~V4dcKQLzCfQ^mN;NGMi0&*gLUh$@`_> zFkN_h{C8f%C(rG9rZC_L3+b4fV)wFe4RXdPjvL0G=foe##wdvdR4--WX zZv8j-_U%y)5jIbtZTv*S=3PXZ<1Ri)$fM0EM2td{qa7Wrc9L1i7XcBeH}AqGKcUmH z^7qTd)-nP&j>L&8-3N!(C9EoW_T&lqSF!P#a?WiMCJ;x)%slumXf#bE6)ZtVVZJyf z?vqDw-H;RWfhpP(xtm#R7O7;b6)pOXz{LI`*yxx$&sLE8LM8D;e)jh3bz3l-?a%0n z?{0R7<<#Fgc)Pdw3~qn?p5D*C{2^zv#d_cFT|?sLPWnRIq5Z7Q6{5Q$`gbb?wi~lG zqrk*TJ5V#mB*sCzgea5dh1ipArg2zy(gR}%N}kw8N~}VGsm&|@d)j$I$Y*es_XEk%ZpTvx0o>|)k9_iu3kdoDt5G<8m^*MZf;P015eSqJ9U@xs)d)3Pp{D| z-d6iZr|w#zruna?R?Gs%Zkio3kBxmh%$1y8vLBUe(vOOc*iHIm(=L%vA(l%mtd?;$ zvq^`Evv4L&_??>OLgf?)3e)jFwO~7jNDusRU}DlkSD@U0Q!{yiIIsOafUTVZA+VoY+gqSX> z>!t8hn@=mmdqTE9B297DTK%24Tgwl_eU)Zmg8nEYOzQXm`{U^Fv(t+JTGc!ezLNa#tk*JKuzx@Qc=4nMdl)7OvO7VWHfGK-61#CEpB# z^Gm!hx6z=+MXqs|?n{v^wtek=>Yp=2C1cWwvgZNPOqp}XCzOb}3+NtP*_S!H^3MibxuhV;}gVb2&K!;^;|h(bh1UzG)HApQNT84tFIEjcW%4GmT6tXe>@nGi-vh z0YLK;N=Al9Qw;YUF^*%@&`*n1Jd0@>94_l0?puOCr{atS)`1gi6c?!|(h;A4FKGaH zC4wA5udT%Sz1xTlq-`lF5*yZEjh#0(-(l1`M!8JrO|uXc=#$zYoy8Dhhl%CL3K-QI zDiQeQ1hiJ|K#^K7?Zk#>4($DL>$oeO4Gw)9YHHgVT@4ghgX1cw0uIkVJy*6HPDfr^ z(DUr~;4FCfBQ*6kUXD{yyNCZ)5YP-@e@5nyCa&85Ub=uPz?)6`t*pFJ`M#-NWJ$@o zO4rCVGa;xvMuM7!acQKs<(_}ZeB*O0*DTK>|14)e&opa4=N!)f|CpMQ&Ux8&m1<3M zPJW3tkSlEM#3_ZhoY)zqZX&iL^8hv~^k{P4N`k=5z1T(QA3wbpStPsCQ% zX?@V#4*Sz=_9%NU08^>CsL9R)^$}C=O(^L0=#JP}&rP+br!d~9ll|65ZG&?1eV(U& zpsoZVS5s6`v`i%(ajPTu_@56XsVUf0F~P0UHG5iw^;Yil45M+GP&k=Mzw|{F<_EkS zDYQFz&(4~ecw#X(UM|rvpHCfiZrj%~c~IuVL&z4YyY>`;Q|`Wq*ZTw(0B;__^H*V% z^Hu)X&H8S)AEH)M(!!2rU%Nia&vRy&EMPS7Zt(XKJFm1|vTcIA7E7=3Uhs^5xwM>^ zSVVigx|b0Y=rg}K4a!qAV<~ z@22b7KJ4{_oWciM>%lXuRsI~Vi7P!RQ6CXOVkFdWGjaiQl|)&IP6tdwb`Xi3=w z^Vn6t{PSbv`Z=ZB$)t8iikO`M<4hCuEjXmeRbhH&pif4dxo0)MnfZ@qh9SrM@;cT| zQ3tBz^KB-ptwt+@AEk&@u4fV|GwXK?l%NF2X=gs zOwxn6+ch&nSgLOb4c7a3<(;-XFmAqf0qL5iNw`pv(k97oiP^!obFJL*RMqDOOW4uv z9(ZFIgNdSfy!tDQ8!PlAmqTFheY1gTMkBp0jjH15^Qpvza1sA>V;MAvJaAf?80+Yz zTxt*v$-**Rvd_zv>!tsBn>nT>meJK&&mmPDgA;kwd1LuHYp_bx>rqvx@*16^OipRE zki#upG0+I{T*81M*FH|l#!LCwZk0h8@v+9D10*`3a#8V})>5Ob_Vu^OW}mmC@)DG* z^JL+pO{>=pvYHEDB#AS{3u&vJ_Q$x<0Y%QGx?hMyOGK19d&@f|2P`bpr3q1^kIhj9 z9^Dj2rAIXOgQ>g;nYmmAUw}^zl5ENLNw#$#V=Q7YBy}6+(n`}=%0CTQl8kd*0E+*@ zuQRM)tfw{WcuIMS(D^UdR4s6rwNNIYSYlUA*9>K+eo_*yz*&WR+;7qq7phW<uJxvnj>!Bq&u8uW96Fv`cu=^G<*^lc+HPlV!HXvNLA9B*15NHvB;u~ zHexx=5pc*Ax~9#@gR`r<*l)WcwR8iD*L%6D;3T??W?*30OMQ8KGs7JaBnf(=R|&QE zMw+Lvj!Q^0b#Um{NQ|N!E2L66l>z?vv@Z=TyT6V^9!@ky8q?x8N?@VHcTA8D z*Mp&4A84VM9!@Y;N{|jjgBaxSu ziP65LL8^#6$1u(~rzuP~_dX|4%F~izECWGVL~+~Ghl{WM$#lCTM;51BS#Jr{Rel_RB2t%TVa;sfB2gV+aSl-E@yKEQYAF!!MbTw@ z)29lr2B=590!~+vnv-g$^sg~0=Ds^wjdcyy z$U!-|KL~r7jsbo>KIJcOLH)?QoefZFd9GRaoH61JWDQx_+EijOJzvi=d`h`yHB~wP zQCCsG+2uJmnb*QMYfosc+tu!M7EOFfx!j>(PsJ^z%qC7*s(eD>Q1M!Kr7;e_`z?Z? zgpI^;?tn3I?BWJ;#UOPL1BxJX?5K9nLvj(NAm$I^Lg8FS0&C3nkLPEkF}rK_>7f-~ ze!bH>ucCzZ^^s2elF~?uW#;@|>Aq6aLbA7QXK~tgohY+)eu(I&@{t`{iu-PlnZEWP4;&D_D5 zXq71ObG1_2q~;OW0p#n{tb9U6rAmx+^-%fHI`@s?nc)c0O3`4oN<|bdyz)0?Cos+y zzNuVui#%}p6q6E>hgNIe&}wXk8d z8*J`W{iXgyiTu>+d<7-Z?`vlZk77frSQ*1jh45qn` zIljF7`$Jz1m0gvw>C_%Rw&I2HlJN!o5`C3aIqmahj`BgD8JvF0b%WHGmIc!>sFm(J z)V5p#R}Ed8J{R9@tqUq>Jmknvr0f2Sy8fqgsuRXf*81+xF+-l`HL%fkA_V| z4|JnFF;c;avnO(VAe#7ml7&n~5l@-$I(fJsRFh7G^u;`+G((-^r_3UySItD$?W+x^ z&%eAekOW_cN}M*K^F3^keg;tvB5SY9;rc})S+p0vaD1d*8Y{S|8}zw9858l@yX?K~ zZt6|Qr0eN-p%2d|Gksm0K_N`(!*S`Yt!p4n<~Kq#Wf*Ti%E(p_%*HrPbh+ekcf0U* zdY~d__}S^BJVH7Qa{s!ZMwf#ay7ty5S#1M_%8RkD7zm?8D@}%1P+~0OM zz7fun^vac$%Kf5!UK{G4;km|)iOI24kACIKJ0ww^h{asL{zbw&HkiJ9T%8oVrs#vM zJ=)_N#;X)dlNn_~p)%4lF6K&0(5b(u-r1XFZgQkqYDj0hhf=~BV_H3QbP)O^9EBTE z?RLEPLOuE$rwcST7|w}g*;WCX+=G9 zV21zUxBre_06Xa$Ihfly**btd=fTJF2G;N3rGNhDgdNNctmM9dYpe`R9p9l#!j48@ zKmvf9nVk{H$;t*Ud1vrm!~kSrVdQ3EW99&Zk(@x*ssJ{2MlNnHHde4tzNmqn6v*7v z%n88B0xktIvx0#M(qPnpxskAqDcHXs3~+ewUF09E1Oo>c|HRJD%*h2{U-n1=!mk1O%}B8*}lWsEBuj#{ZJ_Ulji(G2kDSfRP>| z29BV2X8&98|AcReN{hX>cn2&1!SYCpeY2I67Lzlu1LH`H!Sb6sx&KqF?CuB_UfRaQ z_8lvt1Tr-TBcj{^G{Rt*80a$slfpan%iP8kK=U7D;6i0*J3A|o^}8CG-(e$a?|2a{ zPIhJ;0FWDu$Kd2-WMtvs6urt3)@gD#cE-<@)pNjtrngQfu`S0*C9mNTY0cNz$GrET~k^oZs46GDJ-epY=abBy6Y$v(@ue!H@jigE1 zbI_&Gc(iJV`h(;nVE0T?m6FnyQ}+4SGv;CsZO<0QI)C8 z&WP&ns(Rv8(bmo$&O(Qxe~@XQgDelxLGm5yg_rGY&7ceyt?EcjAs4ziu1IcRwNY@g zxeg@1R4-I(51+VS^H^JpdF}&l3jU^sE_K#9N6TsNBP1o&Tvbv7sCFIH>{@d`ac|RY zNW`E}4uES{dz*ee(E#6%Hb57p|6FiaUU1vVTAj|(^Ks9-P*4+k4pdS``Yqnb_|tL* z%{|;T|B_+`6+a%^GWt*|m(-KYDNka6FDXrmK_$)w?_!|P_bE8x4kx}<>omFGFkeap zOJ?`Q*o;jW9dHl*Yh2uahxLEaIDg#qk4yb8?(mPt0;22x-NnW202tpNkNnG#>81X6 zSeqIFA`H;qA5`fd&=X*RRqfU6EdP*yL;ybV-&rK?e=YT2P!20IJK&7)Kdn3X*5$OJJzybUPew z#~Y@1!u@+7vY=x>6Uu`(7QlBnvJ8!`QDuJYut1I)GwiYUAFCmyF2JiZ{nqu#_K=2piFN0aEKNd73sxNQh zgtq;FHiH|?88koc%WhPb0e266(>I)2nG@7q4!`_F-XmnfWwr5acabw8BsO^nBL5|M z)PxO`Ny%h?@Fvb`b;z4$q$h%#+CpEZr(a{q%5Jn$lKzJxQ97(V{scxCwi&0bGMH}_ zn+W1f$ekKH#avo|+#u+J?QH<*y^p6jDXE_gVWd=Uu0dP;ydiDNIEc|`*BE94Or`+Nkt{}}6O2I|FPJkBnhDvFMfHjY%m{xa!k}hht!i|D zCaI|Iibq%4RvVsOisWnBPsxT=cCWMaI;1dxtKx%+>T5DZ0uk*2n|w9AnfwDS3S=bD z%R>9#CMdNgcJT4&76HN(9i?IE-tB=^W2^PtW z0N+$2n&gC^E|v^zLl!}#ZFCYUOao_F^!aDrLl$+o@eoM~v@)_%z;NQn6T(`P;WJFo zJsk*hvFQy^%XCz|8MA~hM$ZD7SJCJ6=dA3j0vk=+a5N^{* z^rG7izfWHCM`gDyi}-i?E(fo4UgR}%WS?sBk7$p_Kh!eXJNs33aWD7V&{@YcZT##p z!`_iQqSX_^_dgaV3@&Iyax;F~zeMYg`>c@ogk-EkX6SP;i6ICq;FCZcs7-wXU%X}$ z+qJt)sdtjtO|R^`L3x{m8}HC>KwZO1Vv7&Zf!nbHJ2A(Kt82B6^NLAnNdLe$u!{!| zpuZx^09EW~cw*&_w6`5nwhrzILao~4uLbdou97bM^bgHaszz0cmfda{tZFWBZAWZ+ z7Fdq%OzU&4Ma3H|@k6LEjJ=}hZi0|Yh{It)XxhhcDsM-tnl!rh!ivCfC!SBHXcFmC z>yr0HA_&6oH&{?$+JegneAK_Eo!FdzRIaGla%+V}NM3bO+^uYfJKR9nMl92Chg~31 zHZM1?g|u`)e-IYyT9@UqfU>R$o{EUBL<%#ZM=V3W7vH-PVm~=tuT4fvNMw^&DTz~m z3<6!%jBDBeud2nrbn_rUKq)#Xe#!SjSxbmzwMCB`u`U)pI?-KM3nDG;Q$B$Y)vSm5 zfbtJ~A5{Dh!?cXa)RotCj`aefH}-GzNb4hgI{3b))x?r2_gyb#yJAN^j)-}N0}jzy%XkfK6mjF2C!s%nuhzlS0YkvZm- z?Qk7hT}<1|+RX4(KQ|l{n||{z0Y9%06qwFf@GOIEUvyocS@^wB>KAbuiR(HBs()uQ zTy*|J{Iv_uH$7ZwYLiR?uY)W}JS;)h(X=$NtvHZwB(XDaO`c%K*FTCcyyy;rJJ6Ry z8S&EDKwBt$rq07a_|yV)UCO@5_RiKzA^|+u5E&(u&Zt<4ejZvjq#~3zB;xAFRp3>k zgZ2}$z1n=VKC>QN6tQD5m%J{`2CW~3UupSlXW_HhtSoFXZi(A5;SG>y1fK!{qsA}X zJ;0>{TX?HO*ef=^xpjgB(tfJ~IS(AW63@b{ZV3ZX-&_dR&>1xL6g%S6BbiwVR<>Uy zeJ)Jcpp-*IarbuZk-4S8p)isq}327mI#!?>O2r%K1bQ_SDkzPAwBgdruT=PMPL&TXdQm7Y!-$NkkQF2Sa9yz_` z>&1KVh4F>C8KI1lZ$clr&N7#YgNDX$d!P)C6xPX6(@Ep5Ok2d4eMt)|%02 zP#Q}@8U5uFw=9P$g{yR}Y_=&4fz0OC8mJ2EE=zgT(b|8Gdha0R0pi^gFF+oHp=d>s zu)+nZURY(Tq%p9N33Cn40t?0h4zh#XXh$2O%M8D(W})_Dy3}@Lr3>}ESILO&pjFA4 zLA)zH24lyr^HPkLxDaBZkJ}GhyKX68K2vPfD0NtF`XoQpuf!TePK_|EV_vIPsSExk zpI@`0x)-OVm$DYPIe}eoX-7LViuDkwO_eq1VlGDMb=vHOAxG+x%b=UIiktDdt19>*3{h+|`F;d>i3pU+Kk!FCcc zCORSm4IW!9ksxD>e@}L|Z@s8im-kl)Q0$L8wmeSuq2%m6H*WmM2e2%)x^#JoVEykY zrmNak;; zHF(bWl|KS1u>N;OqT?>@m`w8AEX}K_CZ1AvKGm_b>i1DoJ2_pkg z&R6Yv-pr*ITBa@v)9m9sEgdyvWGh-N+(o2j9UMn}=XqC#$duJEjmmTVOggr-wu2|l z`Zmuh#(Ga5@yA)Vu#^-{$ZlCsQmaf!!?{yOq+gUTwe0Ps^&}#ThRFgCHcoFYdC1~U!1`xbaNInzoBgu5Cj&p7~B@a_-hxFtr%$OoLJV0-iB1P zv<(P6K9l>_>!4Y?80w6tVi~cyQl3nvIz~0H{_yEvNhGh7{D@X2Ch5i&IFk+~?6E`& zZWo^BGeN4~R+GM}`YHGAXLf|0hkV1A!JCy=WO*J-%BgA}q)0Ey?y!WrC=!6nnK1>KB&CT^xkl}*#vCvNk z4@`0+V#Ss|;%w)^$D>t9lhA4s7Vxyk5ou%!X5{kMNewkiPs+)wtxGvrGZ0e(7(=k@2bs&usfs*|==6jx&2$ptC}A263%%D#p&HdRor=Jo>>KLaPxT-BZ=<~ZK=Pfcd)R#ZML9rIbHle#;}+j%_{ei5nH6IWLOlsO z(qpj&$_qOlt^iq$!x=r!-m1s)7arD_q1WRy!Jfp^$ixYw70 z6w=84E~b^xSG@FCse{%*{?Xz3>$+VWn+`%0QD8z)nG=D|ztEMmd?rd;DQ1|!=TmN- ztM+UrDnGW=V_iMD95SzX#>M)mN3G?;W<5!LUN~swjj>F}9tck-Sbr}(R7%DxmH-94 z1Tv3KdL8HGt1E7uG3jDCurC`qE*WU6O*4Uyw${bsG-Ji8DMSPGxEZ|Q#o)I^sx0Ca zyUV`srvh1C3YDTg956<9CLiU@O zSvd?$j+`QBrc^P6F0TeMukBUtoZFJofjegg(v>HZWi?je==AY%tHC9&oS*U>yt=sf zs0h-W?W<#E5)miXS)cj2fQq-mZ&+Qf+BfDP-pu;;2?DI?4tGQW+#iQ+@lRh}zn9)n z4uOr%e4}4U0uf(X;eSGD*9pvp*apFbi4~+++q+g3iP{O?ZfoOz!h?qX$0r2|GBXl{ zE12t4ObM3nGo4T1b1^vR94YoBuA#1eS0}=h=>&<|V7QY&%>TrvaM%`t>Nm5{Vt-dB zOqF?K%Ka*$rlo}_!1!Z&g%;XxCM9ho_l=L&ZqsvYm6ICLEH&+MOZN1yaX-P~?FFn^ z(9kcjLb>&l6)ZL9|LXYUF5txL6AIm^DnPqLAXbsG#6N>?f&H*;9@PCcEf9q0TZ9)U zFer}IY`jcfyBSalU4GU=J*bA2$z(HB3p?Nk*E&p8|AjD29E-z!r&JP*ESdgdN7dwARe3vv)n)}@BjrI%ApB&G*e|ipuMy{3PyHS%f8WOP8H{^ z#p>E~8=n@gyt>-$Uh^-SqU)pUnbx}yh=l$kuqx?j>H-ZRvni>1|NvwS&T#PUq zyxhd81Br2Pu_Z=DDd7Ri+@FC*Y7@8S_9Aim*ri+)L}fW&W*+K-1>z~Yg%9(BL-}G)de6aTv>ai?8U_V1&msmM z9DmVwMHALiKp4gp=7`nk;!n#lr|{SW5$+kzb7XzT$aUT2!uU=bZ&1?V`3B<~Il^d? z9d%96-od^AD+;fP@DvwR7vzYLYJHT~{B^nWM2U7i)Z|cnyiX~}h%U?$i^DMCh#_-> zXU=*+CO4G-$k@Y@)@O1zeA|yc#6Dq8;;mBhxLR7zwClTZpbyGIH-aL!hBzr#n6 za&57y#Bt2jZ2_fC2rEB;EH9d)D4JCZ>qrQZ^1c7(o@_izhl*BqH+=56 z?1u1>yGm)xpP<+O=DV2eHcA8;)PAGS4$~Kc<8E-r^{?!um?~(X%%vNF-xDXIYkL@2a+v zdKBHbujJJzt4P+{5wm%LnOI?ydeyf_-+tonqtcSZm#9iOVHcFDrb_w^AaJ=S)QpbS z&*JY9(*3AhCWa$6NRu~w?oXH<8@q913B3)Be*=A1GWqCxZfs>@6}YlgDe`fbd`++Ijz(z4_OfIk=@9f^teG!ImradJK36c zqXMKAj#eiLbY8sb>$C-WxO;(if&=<9Ii*wXs1O{sFksijW+ z#^Js)kAkey0_>DYq7M&qZr-C%eQr~Hu`h9K)%b(`6q|SpY3tawg#g;5vCRNC!1WB4cPizKF zE(*WtLd+nF9x*oMDKM5y3}@GMupJ*pm<|3cYu9LW77HCWn!Jwdg`#^Fi!iAH6Ss1D z1z86L#&JX+D6m$R6e^@J>v-13@+jc4ktQEnwL=J!rwP^l((A(=`k%Osp$MCEV*s`? zFl-_EwWNz^RRpx5Xrm~IG06_%77%YCDhje*gt>$4sTdFRniQodN@2JO3>j%@kmNgo zokMG2|Uc?XE z%b4{@&O{;0h%ZDB02G0f+ZXwk2$GrbrTlw-z%I~HJQvap5~OhVi-FS5Iw%+ODcwc$EF*5y|1zOz&aK0;waK9I$s>273nJ%EYpvRgh1& zoCawNWZv=29JApUBAmBi?y<&0af%Nevk{vjU=4W=7(=ilqPZ3a2@NI@x=xaL*b;Q2Q zZL>jdL;f8?t_|2061yPyh%6)09bW*4@_uCvplvt?A-6dr5c}*G9=DBJ^?VTt0(p^I zdN2P;+(ZJ1o6sk)H-c;FIK@8x2%T-j2;^4GI`C_v#(s)H+gj{8_zR6qK+YB5d;8j) zUDhiiV_v?HR!{<)9}#z8~G7Qv(3vX0H{NK=LdAK-_>Sl6+w2iueFG|F9p3 zMiTac)}C)M{W3jqnfWobS2JeQ7-5f9) zWOV?$hI~T0mW<1}s(WE^=~EU%7Z84nm;cObIsSa&Y&kY~GtT;W2Df=R6s$WQVKAH% ze2tXAoz*}1iO8NsYQCUnmFxK^}zkz6bFpPwl8AGH0e`h=S07qWUsx>ic~ z%-MK+`5{<;4EbR)_X#NHHZMILc^{Y7bBuf6KSxUclur52(@#i_oE!hEkq?XTPscBr z>=QUbhM$#Zl6lkDCYr(MPlE_0IY@(i-H7nTA%ga0jneqpE+l8Lt{H z5=j=HAj#>b*2->>Ti4)E-3nUKrVMvehmH0SiIZT8pAscrkS;~?zy~?O^|gm(^ZS06 zfZBQhdz#_)og!E0{*@ytIgG{xR_ja;P)tc&3{|2(Boe;W0Fc{O@!*e zzOQ|)(_dYmdhnX*s#(H~B)pqV<&m=L@S?F{$0-@*z!i;6Gy;AtFrq8!RH&i-mXl&Y zg<)nu7dMt$SOuq7o`b4wrfco9^3-+wn&4{Koe?3UAkodrIdPG>=&fx3do|gFf!UtP zo~6QUg5p;F7P`UEPGc$r9%7(&)U0Sogwo{Y(l)9;Qe~S>Jh8UdROA~S#$f(vNF_rN z^2`}>_W501?P$sbjl;U#qlYQisw>s6`9m)-(M#T zgbiv99ITa8maE+wGbUV|YV~}16|#R%W+FV8hZ?E;5bQB9k|bW&m4eAR13jqwk)yq+ zY~GuaTl95}TOxImx#9BX=rZ|va+wBAVwtHqcT&!^)EoZj`0y8&dc_3YGgLCtQ$bN^ zz*n~n%xTTMe}dD?+6wIn(GE3ONjvc%%#ZlIC`=4@mbX3BY#nk*QSuR9QAuSL=k~7E z0L#+OvOWb>gEF({Vqj7WD5)ete$50y!(Jgj%sq36_v55&?vR6h9y|p}gDP+x{0HV*7-x&+l-#g{k9f|YF+NYD9clE>^k=Bg9> zCXDS-6Z5!^9G>jFGn;b6jNvupI7Q^5D*4oN7BZd4jQ3u1{GPc+xn7qNHLBl~&ZrdH z=N&D-G&TQLH7a-0O=Q#H-DF#>pRQvnA9$_4{==UXg)rtAvw3Ii>got!P@$Nk^#==TDHfIU=}3P7F=T7$o^ zHZvl&oM8Khlp}suJL6G zJ}>>s^{_aur)1;h?O9=R8^|55M%Addz*wL41_dV!GQeOqSWOX%L&vQNEr@e#~?zHK6dU1!V}Qc~LW~vP@QvPdT>! zcRE(pS_sQ}y^LJCdbN?ddT=20jFlP6;GKqURprcZp;&7e?K}#u1{SUc0d9+CGn|$Y zwU!Zi$DZ$vkyeU$jV?)i3OIMly~shcjKbIRQC%ZbySII^#e_433Bo0L-f59g30C+c zI9H7{LYWD338mEv?~lgUtqMk#b3k^rq$q1A604Ce zBT74F)ML{EZI!Aln=;e`ON`?axZh&U34>uL79Jo)U-;lyZ7;1RmlY`^-)+S&K5`41 zX8;K?c5T%zpmViXgNn7MoGd+eEWLi01O#i!DI9W1#ujZ5bMd9dj+uqhM5Uk2{HjeB zfB;L&TDCcZa#p4eNmxbYE9@JM0X0xnO84Ox+u`j-;~t>Uo%_A~Gb`Oxt47X-*^JcQ zSnZgl;f9pLSmwsqN{1+YYR7zecAs1yGHXh$l0-7MKQ^krq}qXBiDl10LfubyQI|H| z6xnxu?_%4D)49#Nbr4_oh3fIPO2pN|g_0A(1Z_TW4xY~5WgNq0$I7{JkBdQWVJHWF zh}k@<&C-XP1U@=4nO@vbjffGm(v5qfPfT$($VV8ZdO72LA#SQe0qOPC9+~y|I=$O< zBIZ5^^4McHpPIAE)=ALP$UcX4A5Z@?WqjX!YqECvMwWYiq?mf&5+}dC z@7RT_=tGKv1|e1(-ds3$VbV7<#IAIAtSW46TUNc=Ib*c`r#B^Lx8E=4B|hE9jRV1t z_v&zs>gAg~_FpZkWU+{Qli55>POQ`)TM8nJn=5y_YnKo7{<=TCx=fZT7|;9y&ovfz znxozcf!v&45gfKcWL*wm$AJ$gb%f}U#zJx^63xkZ)}Ixs7A%@zaX>KQC7N;XhM#Z@ zW1?4olBEp|&tOf5-a_nE@XQvFB6I_B^~<%k>*Jlv)$$yG>#SUzv`Xg78vCSs^Uzr2 z|Smv>bpo3u6RQ!=Iv%_A4w_rF$2C%>hny4M}q}0HJb!qjuLDCX2%xaSJ{i z#Je|)&an1A@d1YtkCk+skEbFVH-ziqu}K|w>ZQX@j+C~Rra&Son6?tS6&3MRe(c|t zYJ92Ez57z=YP;%+|0|cqUWdnijeh7z*2h=pKKRi^q3E%y%WbEMmN!rQv^MTNPn1ey z4Kqoy-|mNb9;3rIt}(m}f3(e7F=+X0q_(snDyyw-Y{|%?ab$yw7<;F}5DJB@Upd=o z63Q26(0Jr=ERrZWwRNf31(B$o`y>*_5VhNc6{}^dmC;8$F5#|}t}I8L?OuAxb}DqI z5ef^(T|6LS80GoNU=-T|oeQT>QaEc6vQ9#vI~0x$SjfDCq=oauxoFf80*->EV$3HD zUlyI@-bgTe%FNHB-6;H++rRFKVREu}=6RLE>|og{l56U&Mb2eM@(eCP&~92LpA5kl z!0P$n#@*;IEiO{{)!A<%MjBs*2iv3;vV~qMWkR%jcl5GrVdmNX<|1YpDHp_~U-F17 zqL8=+SI8uhUx3D#^S4xx4VwJftr_KI_ig2XsvsH_WVM6#Y-qG!&C4p;2io#^d2Q6T zdE5tIXNS4j(nA7g3TiWeJBi9l%rf7uxC~m#_YVD~BBbOcxPK(+tyb*qixPqbY>99? z%ABT3i6*t$&y@C*orTN}myQz7!IqMu*~6Qb*~i~vS^71|V2LtGm2;NN1#?!Q^`>cG zrICgLB>x1-dC{t?{NN+$xUFc;~o~KFkSvDibq;Y53n68A` z96*h>L`|W9_A|bjf60{wZG{K^0%GDQQ?NYn-e#%vq>y{b6JQOsx|C176^@m^Z`Nna z=9|uOGj;(B$^cYUq(BOKN39V4Lvpt}E$5EPqv4jIq9FnQIf6C?li4kFT{SW!S?Z9{2u(DhU)Xl2N#nKQX3|7cEOM5kjaDH^W`5%@ zXRhmy18?%IpBOXxuO#7prCdmvdFTGZyfEUHp=DyOZh{#6L46!5Nstc&(OxY=K|2*4ayOx;~sZOLdM` z{)JaIvuNRfR=k-+GO$99x+R5oOcy{cuY;BRRzFYQ($3e)&nl;@rFR&2(Gy2;O&WG- zW0Gc-_HT3SR{CB(H^q69L!jKe({3L>#p>--V`47*1;oIZC8_N&X*`W9wZ7IF_S zz3a=;_loDLe&0D5&>L}YtnR9FUCnH&Vhc3gXszk}T z&m=7^P+ulWSwq%0R(+wuq~4Fx+=+fFTUuH@QXG{Zm&Z>1a=Cgmhru14#OSD>q+8y# zrnz4!lUtEvo?S%eFe!U+)n)nFdoMhjRW5lhsS^LBnm520_D#t+P_sA&2_OValZVwU zb^HZRoz*UQnK)|iDjnX?Z3Mj^UjvF$1&R?@+^XWfLIOBU|>4Fr(iM=_b7P@xMik@6%j z5%>CSKnP(siq2iYAg@z?bhf*Q(?bB6%gK@Al*H3^L{shSj8qUiqodHgd!5QbubFnJ z9g4xL;f!s=(s^FT-Bptc=UtOPr_J+jJe{S@ab}TcH$Xo3{v-#{<=x@7L_9|j3h~1C zI;BN_v0v5`v<9Z2t?8~h+17(GhERw17bQgR9z6{Fo(DYm^?;)uULCOAw(M4G%HLa;;!;yyB zP=k>%T-))e$BrcQ3Qx=5t9JzS+xfes+#{>mOk}+DUSQU%+HqM36g>D|r-Gyp<(#-* zQ_OqL=gHsLW@>gvkie{F zV404cy<#2dFD;=mY=8HNWq*3#akl!(U*wfj`oWcmOliDH zJ0vI^<^K)sQ_j)}=Jo4vsy3He7BM-Y!_O7I0}YVWL_^gozi5~1NaIK`-k;Qu<0`n9fd#5npXSR zX3kCQ+kMaIIUgO?-q?au3eVhUe+jGiY)roQ$Iw+CSt@RS&?OE1HoY{jEBU522L0fN z;q0P?u66bZsxGUJaw)8BrtT+iC&@rRYCBfacGgM>s;g`eaoWMi^Yo1t`je!ZUVo93 za7n}7>7@?j)bKFM}f89XVhcefX>%yW|=I9v7eM z^e05<0wqx1qT}Xko^C8miWu2A&Z|7+X|8R!vpwaz@Q~$8s8&>1^9SjB>$4T%3S$)% zG+`Oe=Op1JSp|wr0jP2}xzddH(S!?5?53{!(PE8K1;)@p(<>Tko6BLpZrV5y=Wilf z1q&4#qMWQ_4?qitELbZ2LXz`LW)Q5eJH!6Hy=B{jqf=)7g*iEJTq>3>+irXV%UtF|y5Xdh&tZB!SuEy{W4@P3(R{ZUODXz$?%+<0 z`ut{l3tgQB%1e_@@@1J!)0fiH)8>2dddlpsb6?MTl0)I{tuss7V6z81Kx0}*xBVQw zW2T3pxfP@wMW*K02u-~M;;zKVGS^yhSu^j%fWix5weDKYU?8HC5RM03HdspI8B8P! z$9}WuX~pU?a*pDDMV@|Mp_AN0@a&-*wXrod(~PT*&3?-K9442HCo~2V+=#x|FS0|| zv053XJkS%*k?^FEg70SG~aX>X#Sq30Cg|ZWuMGaeBsAq!k>8PzFyyb%URTr z>`+`IspA{+ZXdJvf}b#mz>k{qJfF7pv!zy{!}j4#31oDdf-8os&!`uCJZcxxGw#VK zn)Jel>j}&x_z0>s`>c^XGOw2F89I7yIDT^SWAbP(8dFd^nxJsSB;2B|0sVU-d|Gl& zSNd{7xx(x=*(9^HTy4f#1o^QkN|oa8Y&7XF$%AC1m?eqPvlcP<&)IrXjPx4I;`^B7GcEDTNJmr+I5tC{=7!ztSkx@#CtQ)MLse9Z&-un4_otJ zT++XYq<<1h|CcgYf9Q|DDbuk0O*iVFIxqhuQ~tdFYsLVq>rb=)2~hb9W%)nFU;!{O z9oGL1MClO$NEiT>^%s=&hq~efsQ&!LNpS)W|BI&ruu?1ln(A-6xd6=8-+KH1fKsvi zP3z}>0%};e{}ZLM3kIN6uYXV~62NndkRf8p5Y)lN|Hcrcu!%fbuJA@!WmTM*jC9G9bW&7B$M`yQbnMIpay+ope z3*BuOHn78<(J;F{^%ioHPD`=(Ubxxe*w7((CH} z{(8yhA2lUTS`1973ZDly*}iX~%}zvX+#*9&ZI=R<@`R~4x^Vwi!LFa9o6Qr4sCKOU zfH!?j?V+)7z0|;;I4GQ2ye-4HHvux{B$J5bNph3;Gv;U1Pu9fmLI>aI1d%++lalsL z1xu{8R3kof^70@Xbe{ssttd*8ip6mI20<9W-Bm3_-{hPYb-(B}FPyGK2 zs`^Ka{Lz2<7gY6+MgChDc>olXV3>$lSYZJC1z2Ihg?9-@n=Zv}FTC>fet8)Y-WKRM_8bEG+B* z8L5A_0rmr=nf~3z%EHC{M_20aZ2@Cu<^r5V{>{e9#Qa}#1K0p$<9{B<0tm|gw6Svh z$5;TfW&6+11z_X&&-t>lu`&VT_}}|uV`b;~kNE;D%>UINI|u83^#^Fl{I~JBI2i%J zRi{64fhv|>U;ivG;}?5-fMC}jo)2(3{0Bk$=M4JC6`Wm+oLv6l2(0V?`jZKUoLpQ{ H0_Oh#*cs4W literal 0 HcmV?d00001 diff --git a/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf.meta b/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf.meta new file mode 100644 index 000000000..a9f8a885d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 593198a96eec1d74c8549e7b54168503 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Documentation.pdf + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials.meta b/Assets/Plugins/AllIn1SpriteShader/Materials.meta new file mode 100644 index 000000000..2637c87c3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 345f2705e87e7424683ef2bd17d38c26 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat b/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat new file mode 100644 index 000000000..6b63a79dd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat @@ -0,0 +1,178 @@ +%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: EmptyMaterial + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _Glow: 0 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat.meta new file mode 100644 index 000000000..5500b7dd4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cc460e5b1c6c0bd498b44195a0c3da99 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat b/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat new file mode 100644 index 000000000..5698c93c9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat @@ -0,0 +1,210 @@ +%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: ScaledTIme + m_Shader: {fileID: 4800000, guid: f3622b3ac1631ea409b0f5811034f3a9, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat.meta new file mode 100644 index 000000000..9f5130698 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3241ea466d4f8334898daf420de4026b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat b/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat new file mode 100644 index 000000000..bf67988ca --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat @@ -0,0 +1,177 @@ +%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: UIStencil + m_Shader: {fileID: 4800000, guid: a53f4bb29f3644b43b5075c6dcfecb32, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat.meta new file mode 100644 index 000000000..adae27016 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7ef34f26b8117334c8ecd9c27a45e2c6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts.meta new file mode 100644 index 000000000..25e7f5c24 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e5ef1ce32696cd4c8ddbe3e0e172819 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs new file mode 100644 index 000000000..6ecf90ba7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs @@ -0,0 +1,96 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace AllIn1SpriteShader +{ + [ExecuteInEditMode] + public class All1CreateUnifiedOutline : MonoBehaviour + { + [SerializeField] private Material outlineMaterial = null; + [SerializeField] private Transform outlineParentTransform = null; + + [Space] + [Header("Only needed if Sprite (ignored if UI)")] + [SerializeField] private int duplicateOrderInLayer = -100; + [SerializeField] private string duplicateSortingLayer = "Default"; + + [Space] + [Header("This operation will delete the component")] + [SerializeField] private bool createUnifiedOutline; + + void Update() + { + if (createUnifiedOutline) + { + if (outlineMaterial == null) + { + createUnifiedOutline = false; + MissingMaterial(); + return; + } + + List children = new List(); + GetAllChildren(transform, ref children); + foreach (Transform t in children) CreateOutlineSpriteDuplicate(t.gameObject); + CreateOutlineSpriteDuplicate(gameObject); + + DestroyImmediate(this); + } + } + + private void CreateOutlineSpriteDuplicate(GameObject target) + { + bool objectIsUi = false; + SpriteRenderer ownSr = target.GetComponent(); + Image ownImage = target.GetComponent(); + if (ownSr != null) objectIsUi = false; + else if (ownImage != null) objectIsUi = true; + else if (ownSr == null && ownImage == null && !transform.Equals(outlineParentTransform)) return; + + GameObject objDuplicate = new GameObject(); + objDuplicate.name = target.name + "Outline"; + objDuplicate.transform.position = target.transform.position; + objDuplicate.transform.rotation = target.transform.rotation; + objDuplicate.transform.localScale = target.transform.lossyScale; + if (outlineParentTransform == null) objDuplicate.transform.parent = target.transform; + else objDuplicate.transform.parent = outlineParentTransform; + + if (!objectIsUi) + { + SpriteRenderer sr = objDuplicate.AddComponent(); + sr.sprite = ownSr.sprite; + sr.sortingOrder = duplicateOrderInLayer; + sr.sortingLayerName = duplicateSortingLayer; + sr.material = outlineMaterial; + sr.flipX = ownSr.flipX; + sr.flipY = ownSr.flipY; + } + else + { + Image image = objDuplicate.AddComponent(); + image.sprite = ownImage.sprite; + image.material = outlineMaterial; + } + } + + private void MissingMaterial() + { +#if UNITY_EDITOR + EditorUtility.DisplayDialog("Missing Material", "Please assign a Material For New Duplicate and try again", "Ok"); +#endif + } + + private void GetAllChildren(Transform parent, ref List transforms) + { + foreach (Transform child in parent) + { + transforms.Add(child); + GetAllChildren(child, ref transforms); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs.meta new file mode 100644 index 000000000..17eaab763 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 264cca4d0f5bbb54eb9de18ca54d1506 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs new file mode 100644 index 000000000..30c00c48b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs @@ -0,0 +1,815 @@ +using System.Collections.Generic; +using System.IO; +using UnityEditor; +using UnityEngine; +using UnityEngine.Tilemaps; +using UnityEngine.UI; +#if UNITY_EDITOR +using UnityEditor.SceneManagement; +#endif + +namespace AllIn1SpriteShader +{ + [ExecuteInEditMode] + [DisallowMultipleComponent] + [AddComponentMenu("AllIn1SpriteShader/AddAllIn1Shader")] + public class AllIn1Shader : MonoBehaviour + { + public enum ShaderTypes + { + Default = 0, + ScaledTime = 1, + MaskedUI = 2, + Urp2dRenderer = 3, + Lit = 5, + Invalid = 4, + } + public ShaderTypes currentShaderType = ShaderTypes.Invalid; + + private Material currMaterial, prevMaterial; + private bool destroyed = false; + private bool matAssigned = false; + private enum AfterSetAction { Clear, CopyMaterial, Reset}; + + [Range(1f, 20f)] public float normalStrength = 5f; + [Range(0f, 3f)] public int normalSmoothing = 1; + [HideInInspector] public bool computingNormal = false; + +#if UNITY_EDITOR + private static float timeLastReload = -1f; + private void Start() + { + if(timeLastReload < 0) timeLastReload = Time.time; + } + + private void Update() + { + if (matAssigned || Application.isPlaying || !gameObject.activeSelf) return; + Renderer sr = GetComponent(); + if (sr != null) + { + if (sr.sharedMaterial == null) + { + CleanMaterial(); + MakeNewMaterial(true); + } + if (sr.sharedMaterial.name.Contains("Default")) MakeNewMaterial(true); + else matAssigned = true; + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + if (img.material.name.Contains("Default")) MakeNewMaterial(true); + else matAssigned = true; + } + } + } +#endif + + private void MakeNewMaterial(bool getShaderTypeFromPrefs, string shaderName = "AllIn1SpriteShader") + { + bool operationSuccessful = SetMaterial(AfterSetAction.Clear, getShaderTypeFromPrefs, shaderName); + #if UNITY_EDITOR + if(operationSuccessful) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Material Created and Assigned"); + #endif + } + + public bool MakeCopy() + { + return SetMaterial(AfterSetAction.CopyMaterial, false, GetStringFromShaderType()); + } + + private void ResetAllProperties(bool getShaderTypeFromPrefs, string shaderName) + { + SetMaterial(AfterSetAction.Reset, getShaderTypeFromPrefs, shaderName); + } + + private string GetStringFromShaderType() + { + currentShaderType = ShaderTypes.Default; + if(currentShaderType == ShaderTypes.Default) return"AllIn1SpriteShader"; + else if(currentShaderType == ShaderTypes.ScaledTime) return"AllIn1SpriteShaderScaledTime"; + else if(currentShaderType == ShaderTypes.MaskedUI) return"AllIn1SpriteShaderUiMask"; + else if(currentShaderType == ShaderTypes.Urp2dRenderer) return"AllIn1Urp2dRenderer"; + else if(currentShaderType == ShaderTypes.Lit) return"AllIn1SpriteShaderLit"; + else return "AllIn1SpriteShader"; + } + + private bool SetMaterial(AfterSetAction action, bool getShaderTypeFromPrefs, string shaderName) + { + #if UNITY_EDITOR + Shader allIn1Shader = AllIn1ShaderWindow.FindShader(shaderName); + if (getShaderTypeFromPrefs) + { + int shaderVariant = PlayerPrefs.GetInt("allIn1DefaultShader"); + currentShaderType = (ShaderTypes)shaderVariant; + if (shaderVariant == 1) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderScaledTime"); + else if (shaderVariant == 2) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderUiMask"); + else if (shaderVariant == 3) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1Urp2dRenderer"); + else if (shaderVariant == 5) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderLit"); + } + + if (!Application.isPlaying && Application.isEditor && allIn1Shader != null) + { + bool rendererExists = false; + Renderer sr = GetComponent(); + if (sr != null) + { + rendererExists = true; + int renderingQueue = 3000; + if(action == AfterSetAction.CopyMaterial) renderingQueue = GetComponent().sharedMaterial.renderQueue; + prevMaterial = new Material(GetComponent().sharedMaterial); + currMaterial = new Material(allIn1Shader); + currMaterial.renderQueue = renderingQueue; + GetComponent().sharedMaterial = currMaterial; + GetComponent().sharedMaterial.hideFlags = HideFlags.None; + matAssigned = true; + + DoAfterSetAction(action); + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + rendererExists = true; + int renderingQueue = 3000; + if(action == AfterSetAction.CopyMaterial) renderingQueue = img.material.renderQueue; + prevMaterial = new Material(img.material); + currMaterial = new Material(allIn1Shader); + currMaterial.renderQueue = renderingQueue; + img.material = currMaterial; + img.material.hideFlags = HideFlags.None; + matAssigned = true; + DoAfterSetAction(action); + } + } + if (!rendererExists) + { + MissingRenderer(); + return false; + } + else + { + SetSceneDirty(); + return true; + } + } + else if (allIn1Shader == null) + { + #if UNITY_EDITOR + string logErrorMessage = "Make sure all AllIn1SpriteShader shader variants are present. Maybe delete the asset and download it again?"; + Debug.LogError(logErrorMessage); + AllIn1ShaderWindow.ShowSceneViewNotification(logErrorMessage); + #endif + return false; + } + #endif + return false; + } + + private void DoAfterSetAction(AfterSetAction action) + { + switch (action) + { + case AfterSetAction.Clear: + ClearAllKeywords(); + break; + case AfterSetAction.CopyMaterial: + currMaterial.CopyPropertiesFromMaterial(prevMaterial); + break; + } + } + + public bool TryCreateNew() + { + bool rendererExists = false; + Renderer sr = GetComponent(); + if (sr != null) + { + rendererExists = true; + if (sr != null && sr.sharedMaterial != null && sr.sharedMaterial.name.Contains("AllIn1")) + { + ResetAllProperties(false, GetStringFromShaderType()); + ClearAllKeywords(); + } + else + { + CleanMaterial(); + MakeNewMaterial(false, GetStringFromShaderType()); + } + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + rendererExists = true; + if (img.material.name.Contains("AllIn1")) + { + ResetAllProperties(false, GetStringFromShaderType()); + ClearAllKeywords(); + } + else MakeNewMaterial(false, GetStringFromShaderType()); + } + } + if (!rendererExists) + { + MissingRenderer(); + } + SetSceneDirty(); + return rendererExists; + } + + public void ClearAllKeywords() + { + SetKeyword("RECTSIZE_ON"); + SetKeyword("OFFSETUV_ON"); + SetKeyword("CLIPPING_ON"); + SetKeyword("POLARUV_ON"); + SetKeyword("TWISTUV_ON"); + SetKeyword("ROTATEUV_ON"); + SetKeyword("FISHEYE_ON"); + SetKeyword("PINCH_ON"); + SetKeyword("SHAKEUV_ON"); + SetKeyword("WAVEUV_ON"); + SetKeyword("ROUNDWAVEUV_ON"); + SetKeyword("DOODLE_ON"); + SetKeyword("ZOOMUV_ON"); + SetKeyword("FADE_ON"); + SetKeyword("TEXTURESCROLL_ON"); + SetKeyword("GLOW_ON"); + SetKeyword("OUTBASE_ON"); + SetKeyword("ONLYOUTLINE_ON"); + SetKeyword("OUTTEX_ON"); + SetKeyword("OUTDIST_ON"); + SetKeyword("DISTORT_ON"); + SetKeyword("WIND_ON"); + SetKeyword("GRADIENT_ON"); + SetKeyword("GRADIENT2COL_ON"); + SetKeyword("RADIALGRADIENT_ON"); + SetKeyword("COLORSWAP_ON"); + SetKeyword("HSV_ON"); + SetKeyword("HITEFFECT_ON"); + SetKeyword("PIXELATE_ON"); + SetKeyword("NEGATIVE_ON"); + SetKeyword("GRADIENTCOLORRAMP_ON"); + SetKeyword("COLORRAMP_ON"); + SetKeyword("GREYSCALE_ON"); + SetKeyword("POSTERIZE_ON"); + SetKeyword("BLUR_ON"); + SetKeyword("MOTIONBLUR_ON"); + SetKeyword("GHOST_ON"); + SetKeyword("ALPHAOUTLINE_ON"); + SetKeyword("INNEROUTLINE_ON"); + SetKeyword("ONLYINNEROUTLINE_ON"); + SetKeyword("HOLOGRAM_ON"); + SetKeyword("CHROMABERR_ON"); + SetKeyword("GLITCH_ON"); + SetKeyword("FLICKER_ON"); + SetKeyword("SHADOW_ON"); + SetKeyword("SHINE_ON"); + SetKeyword("CONTRAST_ON"); + SetKeyword("OVERLAY_ON"); + SetKeyword("OVERLAYMULT_ON"); + SetKeyword("ALPHACUTOFF_ON"); + SetKeyword("ALPHAROUND_ON"); + SetKeyword("CHANGECOLOR_ON"); + SetKeyword("CHANGECOLOR2_ON"); + SetKeyword("CHANGECOLOR3_ON"); + SetKeyword("FOG_ON"); + SetSceneDirty(); + } + + private void SetKeyword(string keyword, bool state = false) + { + if (destroyed) return; + if (currMaterial == null) + { + FindCurrMaterial(); + if (currMaterial == null) + { + MissingRenderer(); + return; + } + } + if (!state) currMaterial.DisableKeyword(keyword); + else currMaterial.EnableKeyword(keyword); + } + + private void FindCurrMaterial() + { + Renderer sr = GetComponent(); + if (sr != null) + { + currMaterial = GetComponent().sharedMaterial; + matAssigned = true; + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + currMaterial = img.material; + matAssigned = true; + } + } + } + + public void CleanMaterial() + { + Renderer sr = GetComponent(); + if (sr != null) + { + sr.sharedMaterial = new Material(Shader.Find("Sprites/Default")); + matAssigned = false; + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + img.material = new Material(Shader.Find("Sprites/Default")); + matAssigned = false; + } + } + SetSceneDirty(); + } + + public bool SaveMaterial() + { +#if UNITY_EDITOR + string sameMaterialPath = AllIn1ShaderWindow.GetMaterialSavePath(); + sameMaterialPath += "/"; + if (!System.IO.Directory.Exists(sameMaterialPath)) + { + EditorUtility.DisplayDialog("The desired Material Save Path doesn't exist", + "Go to Window -> AllIn1ShaderWindow and set a valid folder", "Ok"); + return false; + } + sameMaterialPath += gameObject.name; + string fullPath = sameMaterialPath + ".mat"; + if (System.IO.File.Exists(fullPath)) + { + SaveMaterialWithOtherName(sameMaterialPath); + } + else DoSaving(fullPath); + SetSceneDirty(); + return true; +#else + return false; +#endif + } + private void SaveMaterialWithOtherName(string path, int i = 1) + { + int number = i; + string newPath = path + "_" + number.ToString(); + string fullPath = newPath + ".mat"; + if (System.IO.File.Exists(fullPath)) + { + number++; + SaveMaterialWithOtherName(path, number); + } + else + { + DoSaving(fullPath); + } + } + + private void DoSaving(string fileName) + { +#if UNITY_EDITOR + bool rendererExists = false; + Renderer sr = GetComponent(); + Material matToSave = null; + Material createdMat = null; + if (sr != null) + { + rendererExists = true; + matToSave = sr.sharedMaterial; + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + rendererExists = true; + matToSave = img.material; + } + } + if (!rendererExists) + { + MissingRenderer(); + return; + } + else + { + createdMat = new Material(matToSave); + currMaterial = createdMat; + AssetDatabase.CreateAsset(createdMat, fileName); + Debug.Log(fileName + " has been saved!"); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(fileName, typeof(Material))); + } + if (sr != null) + { + sr.material = createdMat; + } + else + { + Graphic img = GetComponent(); + img.material = createdMat; + } +#endif + } + + public void SetSceneDirty() + { +#if UNITY_EDITOR + if (!Application.isPlaying) EditorSceneManager.MarkAllScenesDirty(); + + //If you get an error here please delete the code block below + #if UNITY_2021_2_OR_NEWER + var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); + #else + var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); + #endif + if (prefabStage != null) EditorSceneManager.MarkSceneDirty(prefabStage.scene); + //Until here +#endif + } + + private void MissingRenderer() + { +#if UNITY_EDITOR + EditorUtility.DisplayDialog("Missing Renderer", "This GameObject (" + + gameObject.name + ") has no Renderer or UI Image component. This AllIn1Shader component will be removed.", "Ok"); + destroyed = true; + DestroyImmediate(this); +#endif + } + + public bool ToggleSetAtlasUvs(bool activate) + { + bool success = false; + SetAtlasUvs atlasUvs = GetComponent(); + if (activate) + { + if (atlasUvs == null) atlasUvs = gameObject.AddComponent(); + if (atlasUvs != null) success = atlasUvs.GetAndSetUVs(); + if(success) SetKeyword("ATLAS_ON", true); + } + else + { + if (atlasUvs != null) + { + atlasUvs.ResetAtlasUvs(); + DestroyImmediate(atlasUvs); + success = true; + } + else + { + #if UNITY_EDITOR + EditorUtility.DisplayDialog("Missing Atlas Uv Setup", "This GameObject (" + gameObject.name + ") has no Atlas Uv Setup.", "Ok"); + #endif + return false; + } + SetKeyword("ATLAS_ON", false); + } + SetSceneDirty(); + return success; + } + + public bool ApplyMaterialToHierarchy() + { + Renderer sr = GetComponent(); + Graphic image = GetComponent(); + Material matToApply = null; + if (sr != null) matToApply = sr.sharedMaterial; + else if (image != null) + { + matToApply = image.material; + } + else + { + MissingRenderer(); + return false; + } + + List children = new List(); + GetAllChildren(transform, ref children); + bool hasPerformedOperation = false; + foreach (Transform t in children) + { + sr = t.gameObject.GetComponent(); + if (sr != null) sr.material = matToApply; + else + { + image = t.gameObject.GetComponent(); + if (image != null) image.material = matToApply; + } + hasPerformedOperation = true; + } + + return hasPerformedOperation; + } + + public void CheckIfValidTarget() + { + Renderer sr = GetComponent(); + Graphic image = GetComponent(); + if (sr == null && image == null) MissingRenderer(); + } + + private void GetAllChildren(Transform parent, ref List transforms) + { + foreach (Transform child in parent) + { + transforms.Add(child); + GetAllChildren(child, ref transforms); + } + } + + public bool RenderToImage() + { +#if UNITY_EDITOR + if (currMaterial == null) + { + FindCurrMaterial(); + if (currMaterial == null) + { + MissingRenderer(); + return false; + } + } + Texture tex = currMaterial.GetTexture("_MainTex"); + if(tex != null) + { + bool success = RenderAndSaveTexture(currMaterial, tex); + if(!success) return false; + } + else + { + SpriteRenderer sr = GetComponent(); + Graphic i = GetComponent(); + if (sr != null && sr.sprite != null && sr.sprite.texture != null) tex = sr.sprite.texture; + else if (i != null && i.mainTexture != null) tex = i.mainTexture; + + if(tex != null) + { + bool success = RenderAndSaveTexture(currMaterial, tex); + if(!success) return false; + } + else{ + EditorUtility.DisplayDialog("No valid target texture found", "All In 1 Shader component couldn't find a valid Main Texture in this GameObject (" + + gameObject.name + "). This means that the material you are using has no Main Texture or that the texture couldn't be reached through the Renderer component you are using." + + " Please make sure to have a valid Main Texture in the Material or Renderer/Graphic component", "Ok"); + return false; + } + } + return true; +#else + return false; +#endif + } + + private bool RenderAndSaveTexture(Material targetMaterial, Texture targetTexture) + { +#if UNITY_EDITOR + float scaleSlider = 1; + if (PlayerPrefs.HasKey("All1ShaderRenderImagesScale")) scaleSlider = PlayerPrefs.GetFloat("All1ShaderRenderImagesScale"); + RenderTexture renderTarget = new RenderTexture((int)(targetTexture.width * scaleSlider), (int)(targetTexture.height * scaleSlider), 0, RenderTextureFormat.ARGB32); + Graphics.Blit(targetTexture, renderTarget, targetMaterial); + Texture2D reaultTex = new Texture2D(renderTarget.width, renderTarget.height, TextureFormat.ARGB32, false); + reaultTex.ReadPixels(new Rect(0, 0, renderTarget.width, renderTarget.height), 0, 0); + reaultTex.Apply(); + + string path = AllIn1ShaderWindow.GetRenderImageSavePath(); + path += "/"; + if (!System.IO.Directory.Exists(path)) + { + EditorUtility.DisplayDialog("The desired Material to Image Save Path doesn't exist", + "Go to Window -> AllIn1ShaderWindow and set a valid folder", "Ok"); + return false; + } + string fullPath = path + gameObject.name + ".png"; + if (System.IO.File.Exists(fullPath)) fullPath = GetNewValidPath(path + gameObject.name); + string pingPath = fullPath; + + string fileName = fullPath.Replace(path, ""); + fileName = fileName.Replace(".png", ""); + fullPath = EditorUtility.SaveFilePanel("Save Render Image", path, fileName, "png"); + if(string.IsNullOrEmpty(fullPath)) + { + Debug.Log("Save operation was cancelled or no valid path was selected."); + return false; + } + + byte[] bytes = reaultTex.EncodeToPNG(); + File.WriteAllBytes(fullPath, bytes); + AssetDatabase.ImportAsset(subPath); + AssetDatabase.Refresh(); + DestroyImmediate(reaultTex); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(pingPath, typeof(Texture))); + Debug.Log("Render Image saved to: " + fullPath + " with scale: " + scaleSlider + " (it can be changed in Window -> AllIn1ShaderWindow)"); + return true; +#else + return false; +#endif + + } + + private string GetNewValidPath(string path, int i = 1) + { + int number = i; + string newPath = path + "_" + number.ToString(); + string fullPath = newPath + ".png"; + if (System.IO.File.Exists(fullPath)) + { + number++; + fullPath = GetNewValidPath(path, number); + } + return fullPath; + } + + #region normalMapCreator + protected virtual void OnEnable() + { +#if UNITY_EDITOR + EditorApplication.update += OnEditorUpdate; +#endif + } + + protected virtual void OnDisable() + { +#if UNITY_EDITOR + EditorApplication.update -= OnEditorUpdate; +#endif + } + + bool needToWait; + int waitingCycles; + int timesWeWaited; + protected virtual void OnEditorUpdate() + { + if (computingNormal) + { + if (needToWait) + { + waitingCycles++; + if (waitingCycles > 5) + { + needToWait = false; + timesWeWaited++; + } + } + else + { + if (timesWeWaited == 1) SetNewNormalTexture2(); + if (timesWeWaited == 2) SetNewNormalTexture3(); + if (timesWeWaited == 3) SetNewNormalTexture4(); + needToWait = true; + } + } + } + + SpriteRenderer normalMapSr; + Renderer normalMapRenderer; + bool isSpriteRenderer; + public void CreateAndAssignNormalMap() + { +#if UNITY_EDITOR + if (GetComponent() != null) + { + EditorUtility.DisplayDialog("This is a tilemap", "This feature isn't supported on Tilemap Renderers." + + " Add a secondary normal map texture instead (you can create a Normal Map in the asset Window)", "Ok"); + return; + } + + normalMapSr = GetComponent(); + normalMapRenderer = GetComponent(); + Debug.LogError($"NORMALMAP_ON: {normalMapRenderer.sharedMaterial.IsKeywordEnabled("NORMALMAP_ON")} -t:{Time.time}"); + if (normalMapSr != null) + { + isSpriteRenderer = true; + SetNewNormalTexture(); + if(!normalMapSr.sharedMaterial.IsKeywordEnabled("NORMALMAP_ON")) normalMapSr.sharedMaterial.EnableKeyword("NORMALMAP_ON"); + } + else if (normalMapRenderer != null) + { + isSpriteRenderer = false; + SetNewNormalTexture(); + if(!normalMapRenderer.sharedMaterial.IsKeywordEnabled("NORMALMAP_ON")) normalMapRenderer.sharedMaterial.EnableKeyword("NORMALMAP_ON"); + } + else + { + if (GetComponent() != null) + { + EditorUtility.DisplayDialog("This is a UI element", "This GameObject (" + + gameObject.name + ") is a UI element. UI elements probably shouldn't have a normal map. Why are you using the light shader variant?", "Ok"); + } + else + { + MissingRenderer(); + } + return; + } +#endif + } + + string path; + private void SetNewNormalTexture() + { +#if UNITY_EDITOR + path = AllIn1ShaderWindow.GetNormalMapSavePath(); + path += "/"; + if (!System.IO.Directory.Exists(path)) + { + EditorUtility.DisplayDialog("The desired folder doesn't exist", + "Go to Window -> AllIn1ShaderWindow and set a valid folder", "Ok"); + return; + } + + computingNormal = true; + needToWait = true; + waitingCycles = 0; + timesWeWaited = 0; +#else + computingNormal = false; + return; +#endif + } + +#if UNITY_EDITOR + TextureImporter importer; + Texture2D mainTex2D; +#endif + private void SetNewNormalTexture2() + { +#if UNITY_EDITOR + if (!isSpriteRenderer) + { + mainTex2D = (Texture2D)normalMapRenderer.sharedMaterial.GetTexture("_MainTex"); + importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(mainTex2D)) as TextureImporter; + } + else importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(normalMapSr.sprite)) as TextureImporter; + + importer.isReadable = true; + importer.SaveAndReimport(); +#endif + } + + string subPath; + private void SetNewNormalTexture3() + { +#if UNITY_EDITOR + Texture2D normalM = null; + if(isSpriteRenderer) normalM = AllIn1ShaderWindow.CreateNormalMap(normalMapSr.sprite.texture, normalStrength, normalSmoothing); + else normalM = AllIn1ShaderWindow.CreateNormalMap(mainTex2D, normalStrength, normalSmoothing); + + byte[] bytes = normalM.EncodeToPNG(); + + path += gameObject.name; + subPath = path + ".png"; + string dataPath = Application.dataPath; + dataPath = dataPath.Replace("/Assets", "/"); + string fullPath = dataPath + subPath; + + File.WriteAllBytes(fullPath, bytes); + AssetDatabase.ImportAsset(subPath); + AssetDatabase.Refresh(); + DestroyImmediate(normalM); +#endif + } + + private void SetNewNormalTexture4() + { +#if UNITY_EDITOR + importer = AssetImporter.GetAtPath(subPath) as TextureImporter; + importer.filterMode = FilterMode.Bilinear; + importer.textureType = TextureImporterType.NormalMap; + importer.wrapMode = TextureWrapMode.Repeat; + importer.SaveAndReimport(); + + if (currMaterial == null) + { + FindCurrMaterial(); + if (currMaterial == null) + { + MissingRenderer(); + return; + } + } + Texture2D normalTex = (Texture2D)AssetDatabase.LoadAssetAtPath(subPath, typeof(Texture2D)); + currMaterial.SetTexture("_NormalMap", normalTex); + + Debug.Log("Normal texture saved to: " + subPath); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(subPath, typeof(Texture))); + + computingNormal = false; +#endif + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs.meta new file mode 100644 index 000000000..9e9f7903c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: ee158225ee1e59f4791627785501d950 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs new file mode 100644 index 000000000..4bc0112ef --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs @@ -0,0 +1,692 @@ +#if UNITY_EDITOR +using System.IO; +using UnityEditor; +using UnityEngine; +using ShaderType = AllIn1SpriteShader.AllIn1Shader.ShaderTypes; + +namespace AllIn1SpriteShader +{ + public class AllIn1ShaderWindow : EditorWindow + { + private const string versionString = "4.32"; + [MenuItem("Tools/AllIn1/SpriteShaderWindow")] + public static void ShowAllIn1ShaderWindowWindow() + { + GetWindow("All In 1 Shader Window"); + } + + public static readonly string CUSTOM_EDITOR_HEADER = "AllIn1SpriteShaderEditorImage"; + private static string basePath = "Assets/Plugins/AllIn1SpriteShader"; + public static readonly string materialsSavesRelativePath = "/Materials"; + public static readonly string renderImagesSavesRelativePath = "/Textures"; + public static readonly string normalMapSavesRelativePath = "/Textures/NormalMaps"; + public static readonly string gradientSavesRelativePath = "/Textures/GradientTextures"; + + public Vector2 scrollPosition = Vector2.zero; + private Texture2D imageInspector; + private DefaultAsset materialTargetFolder = null; + private GUIStyle style, bigLabel = new GUIStyle(), titleStyle = new GUIStyle(); + private const int bigFontSize = 16; + + AllIn1Shader.ShaderTypes shaderTypes = AllIn1Shader.ShaderTypes.Default; + bool showUrpWarning = false; + double warningTime = 0f; + + private Texture2D targetNormalImage; + private float normalStrength = 5f; + private int normalSmoothing = 1; + private int isComputingNormals = 0; + + private enum TextureSizes + { + _2 = 2, + _4 = 4, + _8 = 8, + _16 = 16, + _32 = 32, + _64 = 64, + _128 = 128, + _256 = 256, + _512 = 512, + _1024 = 1024, + _2048 = 2048 + } + private TextureSizes textureSizes = TextureSizes._128; + [SerializeField] private Gradient gradient = new Gradient(); + private FilterMode gradientFiltering = FilterMode.Bilinear; + + private enum ImageType + { + ShowImage, + HideInComponent, + HideEverywhere + } + private ImageType imageType; + + private void OnGUI() + { + style = new GUIStyle(EditorStyles.helpBox); + style.margin = new RectOffset(0, 0, 0, 0); + bigLabel = new GUIStyle(EditorStyles.boldLabel); + bigLabel.fontSize = bigFontSize; + titleStyle.alignment = TextAnchor.MiddleLeft; + + using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition, GUILayout.Width(position.width), GUILayout.Height(position.height))) + { + scrollPosition = scrollView.scrollPosition; + + ShowImageAndSetImageEditorPref(); + + ShowAssetImageOptionsToggle(); + + DefaultAssetShader(); + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Material Save Path", bigLabel); + GUILayout.Space(20); + GUILayout.Label("Select the folder where new Materials will be saved when the Save Material To Folder button of the asset component is pressed", EditorStyles.boldLabel); + HandleSaveFolderEditorPref("All1ShaderMaterials", basePath + materialsSavesRelativePath, "Material"); + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Render Material to Image Save Path", bigLabel); + GUILayout.Space(20); + EditorGUILayout.BeginHorizontal(); + { + float scaleSlider = 1; + if (PlayerPrefs.HasKey("All1ShaderRenderImagesScale")) scaleSlider = PlayerPrefs.GetFloat("All1ShaderRenderImagesScale"); + GUILayout.Label("Rendered Image Texture Scale", GUILayout.MaxWidth(190)); + scaleSlider = EditorGUILayout.Slider(scaleSlider, 0.2f, 5f, GUILayout.MaxWidth(200)); + if (GUILayout.Button("Default Value", GUILayout.MaxWidth(100))) PlayerPrefs.SetFloat("All1ShaderRenderImagesScale", 1f); + else PlayerPrefs.SetFloat("All1ShaderRenderImagesScale", scaleSlider); + } + EditorGUILayout.EndVertical(); + GUILayout.Label("Select the folder where new Images will be saved when the Render Material To Image button of the asset component is pressed", EditorStyles.boldLabel); + HandleSaveFolderEditorPref("All1ShaderRenderImages", basePath + renderImagesSavesRelativePath, "Images"); + + DrawLine(Color.grey, 1, 3); + NormalMapCreator(); + + DrawLine(Color.grey, 1, 3); + GradientCreator(); + + DrawLine(Color.grey, 1, 3); + GUILayout.Space(10); + SceneNotificationsToggle(); + + DrawLine(Color.grey, 1, 3); + GUILayout.Space(10); + RefreshLitShader(); + + GUILayout.Space(10); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Current asset version is " + versionString, EditorStyles.boldLabel); + } + } + + private void ShowImageAndSetImageEditorPref() + { + if(!EditorPrefs.HasKey("allIn1ImageConfig")) + { + EditorPrefs.SetInt("allIn1ImageConfig", (int) ImageType.ShowImage); + } + + imageType = (ImageType) EditorPrefs.GetInt("allIn1ImageConfig"); + if(imageType == ImageType.HideEverywhere) return; + switch(imageType) + { + case ImageType.ShowImage: + case ImageType.HideInComponent: + if(imageInspector == null) imageInspector = GetInspectorImage(); + break; + } + + if(imageInspector) + { + Rect rect = EditorGUILayout.GetControlRect(GUILayout.Height(50)); + GUI.DrawTexture(rect, imageInspector, ScaleMode.ScaleToFit, true); + } + DrawLine(Color.grey, 1, 3); + } + + public static Texture2D GetInspectorImage() => GetImage(CUSTOM_EDITOR_HEADER); + + private static Texture2D GetImage(string textureName) + { + string[] guids = AssetDatabase.FindAssets($"{textureName} t:texture"); + if(guids.Length > 0) + { + string path = AssetDatabase.GUIDToAssetPath(guids[0]); + return AssetDatabase.LoadAssetAtPath(path); + } + return null; + } + + private void ShowAssetImageOptionsToggle() + { + GUILayout.Label("Asset Image Display Options", bigLabel); + GUILayout.Space(20); + + int previousImageType = (int) imageType; + imageType = (ImageType) EditorGUILayout.EnumPopup(imageType, GUILayout.MaxWidth(200)); + if((int) imageType != previousImageType) EditorPrefs.SetInt("allIn1ImageConfig", (int) imageType); + + DrawLine(Color.grey, 1, 3); + } + + private void DefaultAssetShader() + { + GUILayout.Label("Default Asset Shader", bigLabel); + GUILayout.Space(20); + GUILayout.Label("This is the shader variant that will be assigned by default to Sprites and UI Images when the asset component is added", EditorStyles.boldLabel); + + bool isUrp = false; + Shader temp = FindShader("AllIn1Urp2dRenderer"); + if (temp != null) isUrp = true; + + shaderTypes = (AllIn1Shader.ShaderTypes)PlayerPrefs.GetInt("allIn1DefaultShader"); + int previousShaderType = (int)shaderTypes; + shaderTypes = (AllIn1Shader.ShaderTypes)EditorGUILayout.EnumPopup(shaderTypes, GUILayout.MaxWidth(200)); + + if (previousShaderType != (int)shaderTypes) + { + if (!isUrp && shaderTypes == AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + showUrpWarning = true; + warningTime = EditorApplication.timeSinceStartup + 5; + } + else + { + PlayerPrefs.SetInt("allIn1DefaultShader", (int)shaderTypes); + showUrpWarning = false; + } + } + + if (warningTime < EditorApplication.timeSinceStartup) showUrpWarning = false; + if (isUrp) showUrpWarning = false; + if (!isUrp && !showUrpWarning && shaderTypes == AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + showUrpWarning = true; + warningTime = EditorApplication.timeSinceStartup + 5; + shaderTypes = AllIn1Shader.ShaderTypes.Default; + PlayerPrefs.SetInt("allIn1DefaultShader", (int)shaderTypes); + } + + if (showUrpWarning) EditorGUILayout.HelpBox( + "You can't set the URP 2D Renderer variant since you didn't import the URP package available in the asset root folder (SEE DOCUMENTATION)", + MessageType.Error, + true); + } + + private void NormalMapCreator() + { + GUILayout.Label("Normal Map Creator", bigLabel); + + GUILayout.Space(20); + GUILayout.Label("Select the folder where new Normal Maps will be saved when the Create Normal Map button of the asset component is pressed (URP only)", EditorStyles.boldLabel); + HandleSaveFolderEditorPref("All1ShaderNormals", basePath + normalMapSavesRelativePath, "Normal Maps"); + + GUILayout.Space(20); + GUILayout.Label("Assign a sprite you want to create a normal map from. Choose the normal map settings and press the 'Create And Save Normal Map' button", EditorStyles.boldLabel); + targetNormalImage = (Texture2D)EditorGUILayout.ObjectField("Target Image", targetNormalImage, typeof(Texture2D), false, GUILayout.MaxWidth(225)); + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Normal Strength:", GUILayout.MaxWidth(150)); + normalStrength = EditorGUILayout.Slider(normalStrength, 1f, 20f, GUILayout.MaxWidth(400)); + } + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Normal Smoothing:", GUILayout.MaxWidth(150)); + normalSmoothing = EditorGUILayout.IntSlider(normalSmoothing, 0, 3, GUILayout.MaxWidth(400)); + } + EditorGUILayout.EndHorizontal(); + + if (isComputingNormals == 0) + { + if (targetNormalImage != null) + { + if (GUILayout.Button("Create And Save Normal Map")) + { + isComputingNormals = 1; + return; + } + } + else + { + GUILayout.Label("Add a Target Image to use this feature", EditorStyles.boldLabel); + } + } + else + { + GUILayout.Label("Normal Map is currently being created, be patient", EditorStyles.boldLabel, GUILayout.Height(40)); + Repaint(); + isComputingNormals++; + if (isComputingNormals > 5) + { + string assetPath = AssetDatabase.GetAssetPath(targetNormalImage); + var tImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter; + if (tImporter != null) + { + tImporter.isReadable = true; + tImporter.SaveAndReimport(); + } + + Texture2D normalToSave = CreateNormalMap(targetNormalImage, normalStrength, normalSmoothing); + + string prefSavedPath = PlayerPrefs.GetString("All1ShaderNormals") + "/"; + string path = prefSavedPath + "NormalMap.png"; + if(System.IO.File.Exists(path)) path = GetNewValidPath(path); + string texName = path.Replace(prefSavedPath, ""); + + path = EditorUtility.SaveFilePanel("Save texture as PNG", prefSavedPath, texName, "png"); + //If you are reading this you might have encountered an error in Unity 2022 Mac builds, if that's the case comment the line above and uncomment the line below + //path = prefSavedPath + texName + ".png"; + + if (path.Length != 0) + { + byte[] pngData = normalToSave.EncodeToPNG(); + if (pngData != null) File.WriteAllBytes(path, pngData); + AssetDatabase.Refresh(); + + if (path.IndexOf("Assets/") >= 0) + { + string subPath = path.Substring(path.IndexOf("Assets/")); + TextureImporter importer = AssetImporter.GetAtPath(subPath) as TextureImporter; + if (importer != null) + { + Debug.Log("Normal Map saved inside the project: " + subPath); + importer.filterMode = FilterMode.Bilinear; + importer.textureType = TextureImporterType.NormalMap; + importer.wrapMode = TextureWrapMode.Repeat; + importer.SaveAndReimport(); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(subPath, typeof(Texture))); + } + } + else Debug.Log("Normal Map saved outside the project: " + path); + } + isComputingNormals = 0; + } + } + GUILayout.Label("*This process will freeze the editor for some seconds, larger images will take longer", EditorStyles.boldLabel); + } + + private void HandleSaveFolderEditorPref(string keyName, string defaultPath, string logsFeatureName) + { + if (!PlayerPrefs.HasKey(keyName)) PlayerPrefs.SetString(keyName, defaultPath); + materialTargetFolder = (DefaultAsset)AssetDatabase.LoadAssetAtPath(PlayerPrefs.GetString(keyName), typeof(DefaultAsset)); + if (materialTargetFolder == null) + { + PlayerPrefs.SetString(keyName, defaultPath); + materialTargetFolder = (DefaultAsset)AssetDatabase.LoadAssetAtPath(PlayerPrefs.GetString(keyName), typeof(DefaultAsset)); + if (materialTargetFolder == null) + { + materialTargetFolder = (DefaultAsset)AssetDatabase.LoadAssetAtPath("Assets/", typeof(DefaultAsset)); + if(materialTargetFolder == null) + { + EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(600)); + EditorGUILayout.HelpBox("Folder is invalid, please select a valid one", MessageType.Error, true); + EditorGUILayout.EndHorizontal(); + } + else PlayerPrefs.SetString("Assets/", defaultPath); + } + } + materialTargetFolder = (DefaultAsset)EditorGUILayout.ObjectField("New " + logsFeatureName + " Folder", + materialTargetFolder, typeof(DefaultAsset), false, GUILayout.MaxWidth(500)); + + if (materialTargetFolder != null && IsAssetAFolder(materialTargetFolder)) + { + string path = AssetDatabase.GetAssetPath(materialTargetFolder); + PlayerPrefs.SetString(keyName, path); + EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(600)); + EditorGUILayout.HelpBox("Valid folder! " + logsFeatureName + " save path: " + path, MessageType.Info); + EditorGUILayout.EndHorizontal(); + } + else + { + EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(600)); + EditorGUILayout.HelpBox("Select the new " + logsFeatureName + " Folder", MessageType.Warning, true); + EditorGUILayout.EndHorizontal(); + } + } + + private void GradientCreator() + { + GUILayout.Label("Gradient Creator", bigLabel); + GUILayout.Space(20); + GUILayout.Label("This feature can be used to create textures for the Color Ramp Effect", EditorStyles.boldLabel); + + EditorGUILayout.GradientField("Gradient", gradient, GUILayout.Height(25), GUILayout.MaxWidth(500)); + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Texture Size:", GUILayout.MaxWidth(145)); + textureSizes = (TextureSizes)EditorGUILayout.EnumPopup(textureSizes, GUILayout.MaxWidth(200)); + } + EditorGUILayout.EndHorizontal(); + + int textureSize = (int)textureSizes; + Texture2D gradTex = new Texture2D(textureSize, 1, TextureFormat.RGBA32, false); + for (int i = 0; i < textureSize; i++) gradTex.SetPixel(i, 0, gradient.Evaluate((float)i / (float)textureSize)); + gradTex.Apply(); + + GUILayout.Space(20); + GUILayout.Label("Select the folder where new Gradient Textures will be saved", EditorStyles.boldLabel); + HandleSaveFolderEditorPref("All1ShaderGradients", basePath + gradientSavesRelativePath, "Gradient"); + + string prefSavedPath = PlayerPrefs.GetString("All1ShaderGradients") + "/"; + if (Directory.Exists(prefSavedPath)) + { + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Gradient Texture Filtering: ", GUILayout.MaxWidth(170)); + gradientFiltering = (FilterMode)EditorGUILayout.EnumPopup(gradientFiltering, GUILayout.MaxWidth(200)); + } + EditorGUILayout.EndHorizontal(); + + if (GUILayout.Button("Save Gradient Texture", GUILayout.MaxWidth(500))) + { + string path = prefSavedPath + "ColorGradient.png"; + if(System.IO.File.Exists(path)) path = GetNewValidPath(path); + string texName = path.Replace(prefSavedPath, ""); + + path = EditorUtility.SaveFilePanel("Save texture as PNG", prefSavedPath, texName, "png"); + if (path.Length != 0) + { + byte[] pngData = gradTex.EncodeToPNG(); + if (pngData != null) File.WriteAllBytes(path, pngData); + AssetDatabase.Refresh(); + + if (path.IndexOf("Assets/") >= 0) + { + string subPath = path.Substring(path.IndexOf("Assets/")); + TextureImporter importer = AssetImporter.GetAtPath(subPath) as TextureImporter; + if (importer != null) + { + Debug.Log("Gradient saved inside the project: " + subPath); + importer.filterMode = gradientFiltering; + importer.SaveAndReimport(); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(subPath, typeof(Texture))); + } + } + else Debug.Log("Gradient saved outside the project: " + path); + } + } + } + } + + private static bool IsAssetAFolder(Object obj) + { + string path = ""; + + if (obj == null) return false; + + path = AssetDatabase.GetAssetPath(obj.GetInstanceID()); + + if (path.Length > 0) + { + if (Directory.Exists(path)) return true; + else return false; + } + return false; + } + + private static string GetNewValidPath(string path, string extension = ".png", int i = 1) + { + int number = i; + path = path.Replace(extension, ""); + string newPath = path + "_" + number.ToString(); + string fullPath = newPath + extension; + if(File.Exists(fullPath)) + { + number++; + fullPath = GetNewValidPath(path, extension, number); + } + + return fullPath; + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } + + public static Texture2D CreateNormalMap(Texture2D t, float normalMult = 5f, int normalSmooth = 0) + { + int width = t.width; + int height = t.height; + Color[] sourcePixels = t.GetPixels(); + Color[] resultPixels = new Color[width * height]; + Vector3 vScale = new Vector3(0.3333f, 0.3333f, 0.3333f); + + for(int y = 0; y < height; y++) + { + for(int x = 0; x < width; x++) + { + int index = x + y * width; + Vector3 cSampleNegXNegY = GetPixelClamped(sourcePixels, x - 1, y - 1, width, height); + Vector3 cSampleZerXNegY = GetPixelClamped(sourcePixels, x, y - 1, width, height); + Vector3 cSamplePosXNegY = GetPixelClamped(sourcePixels, x + 1, y - 1, width, height); + Vector3 cSampleNegXZerY = GetPixelClamped(sourcePixels, x - 1, y, width, height); + Vector3 cSamplePosXZerY = GetPixelClamped(sourcePixels, x + 1, y, width, height); + Vector3 cSampleNegXPosY = GetPixelClamped(sourcePixels, x - 1, y + 1, width, height); + Vector3 cSampleZerXPosY = GetPixelClamped(sourcePixels, x, y + 1, width, height); + Vector3 cSamplePosXPosY = GetPixelClamped(sourcePixels, x + 1, y + 1, width, height); + + float fSampleNegXNegY = Vector3.Dot(cSampleNegXNegY, vScale); + float fSampleZerXNegY = Vector3.Dot(cSampleZerXNegY, vScale); + float fSamplePosXNegY = Vector3.Dot(cSamplePosXNegY, vScale); + float fSampleNegXZerY = Vector3.Dot(cSampleNegXZerY, vScale); + float fSamplePosXZerY = Vector3.Dot(cSamplePosXZerY, vScale); + float fSampleNegXPosY = Vector3.Dot(cSampleNegXPosY, vScale); + float fSampleZerXPosY = Vector3.Dot(cSampleZerXPosY, vScale); + float fSamplePosXPosY = Vector3.Dot(cSamplePosXPosY, vScale); + + float edgeX = (fSampleNegXNegY - fSamplePosXNegY) * 0.25f + (fSampleNegXZerY - fSamplePosXZerY) * 0.5f + (fSampleNegXPosY - fSamplePosXPosY) * 0.25f; + float edgeY = (fSampleNegXNegY - fSampleNegXPosY) * 0.25f + (fSampleZerXNegY - fSampleZerXPosY) * 0.5f + (fSamplePosXNegY - fSamplePosXPosY) * 0.25f; + + Vector2 vEdge = new Vector2(edgeX, edgeY) * normalMult; + Vector3 norm = new Vector3(vEdge.x, vEdge.y, 1.0f).normalized; + resultPixels[index] = new Color(norm.x * 0.5f + 0.5f, norm.y * 0.5f + 0.5f, norm.z * 0.5f + 0.5f, 1); + } + } + + if(normalSmooth > 0) + { + resultPixels = SmoothNormals(resultPixels, width, height, normalSmooth); + } + + Texture2D texNormal = new Texture2D(width, height, TextureFormat.RGB24, false, false); + texNormal.SetPixels(resultPixels); + texNormal.Apply(); + return texNormal; + } + + private static Vector3 GetPixelClamped(Color[] pixels, int x, int y, int width, int height) + { + x = Mathf.Clamp(x, 0, width - 1); + y = Mathf.Clamp(y, 0, height - 1); + Color c = pixels[x + y * width]; + return new Vector3(c.r, c.g, c.b); + } + + private static Color[] SmoothNormals(Color[] pixels, int width, int height, int normalSmooth) + { + Color[] smoothedPixels = new Color[pixels.Length]; + float step = 0.00390625f * normalSmooth; + + for(int y = 0; y < height; y++) + { + for(int x = 0; x < width; x++) + { + float pixelsToAverage = 0.0f; + Color c = pixels[x + y * width]; + pixelsToAverage++; + + for(int offsetY = -normalSmooth; offsetY <= normalSmooth; offsetY++) + { + for(int offsetX = -normalSmooth; offsetX <= normalSmooth; offsetX++) + { + if(offsetX == 0 && offsetY == 0) continue; + + int sampleX = Mathf.Clamp(x + offsetX, 0, width - 1); + int sampleY = Mathf.Clamp(y + offsetY, 0, height - 1); + + c += pixels[sampleX + sampleY * width]; + pixelsToAverage++; + } + } + + smoothedPixels[x + y * width] = c / pixelsToAverage; + } + } + + return smoothedPixels; + } + + [MenuItem("Assets/Create/AllIn1Shader Materials/CreateDefaultMaterial")] + public static void CreateDefaultMaterial() + { + CreateMaterial("AllIn1SpriteShader"); + } + + [MenuItem("Assets/Create/AllIn1Shader Materials/CreateScaledTimeMaterial")] + public static void CreateScaledTimeMaterial() + { + CreateMaterial("AllIn1SpriteShaderScaledTime"); + } + + [MenuItem("Assets/Create/AllIn1Shader Materials/CreateUiMaskMaterial")] + public static void CreateUiMaskMaterial() + { + CreateMaterial("AllIn1SpriteShaderUiMask"); + } + + private static void CreateMaterial(string shaderName) + { + string selectedPath = AssetDatabase.GetAssetPath(Selection.activeObject); + + if(!string.IsNullOrEmpty(selectedPath) && Directory.Exists(selectedPath)) + { + Material material = new Material(FindShader(shaderName)); + string fullPath = selectedPath + "/Mat-" + shaderName + ".mat"; + if(File.Exists(fullPath)) fullPath = GetNewValidPath(fullPath, ".mat"); + AssetDatabase.CreateAsset(material, fullPath); + AssetDatabase.Refresh(); + } + else + { + Debug.LogWarning("Please select a valid folder in the Project Window."); + } + } + + private void OnEnable() => GetBasePath(); + + private static void GetBasePath() + { + string[] guids = AssetDatabase.FindAssets("t:folder AllIn1SpriteShader"); + if(guids.Length > 0) + { + basePath = AssetDatabase.GUIDToAssetPath(guids[0]); + } + else + { + Debug.LogError("AllIn1SpriteShader folder not found in the project."); + basePath = "Assets/Plugins/AllIn1SpriteShader"; + } + } + + public static string GetMaterialSavePath() + { + if(!PlayerPrefs.HasKey("All1ShaderMaterials")) + { + GetBasePath(); + return basePath + materialsSavesRelativePath; + } + return PlayerPrefs.GetString("All1ShaderMaterials"); + } + + public static string GetRenderImageSavePath() + { + if(!PlayerPrefs.HasKey("All1ShaderRenderImages")) + { + GetBasePath(); + return basePath + renderImagesSavesRelativePath; + } + return PlayerPrefs.GetString("All1ShaderRenderImages"); + } + + public static string GetNormalMapSavePath() + { + if(!PlayerPrefs.HasKey("All1ShaderNormals")) + { + GetBasePath(); + return basePath + normalMapSavesRelativePath; + } + return PlayerPrefs.GetString("All1ShaderNormals"); + } + + private void SceneNotificationsToggle() + { + float previousLabelWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 200f; + bool areNotificationsEnabled = EditorPrefs.GetInt("DisplaySceneViewNotifications", 1) == 1; + areNotificationsEnabled = EditorGUILayout.Toggle("Display Scene View Notifications", areNotificationsEnabled); + EditorPrefs.SetInt("DisplaySceneViewNotifications", areNotificationsEnabled ? 1 : 0); + EditorGUIUtility.labelWidth = previousLabelWidth; + } + + private static void RefreshLitShader() + { + GUILayout.Label("Force the Lit Shader to be reconfigured"); + GUILayout.Label("If you are getting some error or have changed the render pipeline press the button below"); + if (GUILayout.Button("Refresh Lit Shader", GUILayout.MaxWidth(500f))) + { + AllIn1ShaderImporter.ForceReimport(); + } + } + + public static void SceneViewNotificationAndLog(string message) + { + Debug.Log(message); + ShowSceneViewNotification(message); + } + + public static void ShowSceneViewNotification(string message) + { + bool showNotification = EditorPrefs.GetInt("DisplaySceneViewNotifications", 1) == 1; + if(!showNotification) return; + + GUIContent content = new GUIContent(message); + #if UNITY_2019_1_OR_NEWER + SceneView.lastActiveSceneView.ShowNotification(content, 1.5f); + #else + SceneView.lastActiveSceneView.ShowNotification(content); + #endif + } + + public static Shader FindShader(string shaderName) + { + string[] guids = AssetDatabase.FindAssets($"{shaderName} t:shader"); + foreach(string guid in guids) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + Shader shader = AssetDatabase.LoadAssetAtPath(path); + if(shader != null) + { + string fullShaderName = shader.name; + string actualShaderName = fullShaderName.Substring(fullShaderName.LastIndexOf('/') + 1); + if(actualShaderName.Equals(shaderName)) return shader; + } + } + return null; + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs.meta new file mode 100644 index 000000000..bc5bf4287 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: b642652081667ab4fad9f2579fec0e51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor.meta new file mode 100644 index 000000000..4d7651e60 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 88005189a0eaefe4aa34961fe0208e26 +folderAsset: yes +timeCreated: 1464994693 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs new file mode 100644 index 000000000..8cd33e522 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs @@ -0,0 +1,282 @@ +#if UNITY_EDITOR +using System; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace AllIn1SpriteShader +{ + public class AllIn1ShaderGradientDrawer : MaterialPropertyDrawer + { + private int resolution; + private Texture2D textureAsset; + private static MethodInfo reinitializeMethod; + private static MethodInfo resizeMethod; + + public AllIn1ShaderGradientDrawer() + { + resolution = 64; + } + + public AllIn1ShaderGradientDrawer(float res) + { + resolution = (int)res; + } + + private static bool IsPropertyTypeSuitable(MaterialProperty prop) + { + return prop.type == MaterialProperty.PropType.Texture; + } + + private string TextureName(MaterialProperty prop) => $"z{prop.name}Tex"; + private string OldName(MaterialProperty prop) => $"{prop.name}Tex"; + + public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + if (!IsPropertyTypeSuitable(prop)) + { + EditorGUI.HelpBox(position, $"[Gradient] used on non-texture property \"{prop.name}\"", MessageType.Error); + return; + } + + if (!AssetDatabase.Contains(prop.targets.FirstOrDefault())) + { + EditorGUI.HelpBox(position, "Save Material To Folder to use this effect. Or use the regular Color Ramp instead", MessageType.Error); + return; + } + + string textureName = TextureName(prop); + string oldTextureName = OldName(prop); + + Gradient currentGradient = null; + if (prop.targets.Length == 1) + { + Material target = (Material)prop.targets[0]; + string path = AssetDatabase.GetAssetPath(target); + textureAsset = GetTexture(path, textureName, oldTextureName); + if (textureAsset != null) currentGradient = DecodeGradient(prop, textureAsset.name); + if (currentGradient == null) currentGradient = new Gradient() { }; + + EditorGUI.showMixedValue = false; + } + else + { + EditorGUI.showMixedValue = true; + } + + using (EditorGUI.ChangeCheckScope changeScope = new EditorGUI.ChangeCheckScope()) + { + currentGradient = EditorGUILayout.GradientField(label, currentGradient, GUILayout.Height(15)); + + if (changeScope.changed) + { + string encodedGradient = EncodeGradient(currentGradient); + string fullAssetName = textureName + encodedGradient; + foreach (Object target in prop.targets) + { + if (!AssetDatabase.Contains(target)) continue; + + string path = AssetDatabase.GetAssetPath(target); + Texture2D textureAsset = GetTexture(path, textureName, oldTextureName); + Undo.RecordObject(textureAsset, "Change Material Gradient"); + textureAsset.name = fullAssetName; + BakeGradient(currentGradient, textureAsset); + EditorUtility.SetDirty(textureAsset); + + Material material = (Material)target; + material.SetTexture(prop.name, textureAsset); + } + } + } + EditorGUI.showMixedValue = false; + } + + private Texture2D GetTexture(string path, string name, string possibleOldName) + { + textureAsset = GetTextureAsset(path, name); + if(textureAsset == null) + { + textureAsset = GetTextureAsset(path, possibleOldName); + if(textureAsset != null) + { + textureAsset.name = textureAsset.name.Replace(possibleOldName, name); + EditorUtility.SetDirty(textureAsset); + } + } + if (textureAsset == null) CreateTexture(path, name); + if(textureAsset.width != resolution) + { + ResizeTexture(textureAsset, resolution, 1); + EditorUtility.SetDirty(textureAsset); + AssetDatabase.SaveAssets(); + } + return textureAsset; + } + + private void ResizeTexture(Texture2D texture, int width, int height) + { + if(reinitializeMethod == null && resizeMethod == null) + { + reinitializeMethod = typeof(Texture2D).GetMethod("Reinitialize", new[] { typeof(int), typeof(int) }); + if(reinitializeMethod == null) resizeMethod = typeof(Texture2D).GetMethod("Resize", new[] { typeof(int), typeof(int) }); + } + + if(reinitializeMethod != null) reinitializeMethod.Invoke(texture, new object[] { width, height }); + else if(resizeMethod != null) resizeMethod.Invoke(texture, new object[] { width, height }); + } + + private void CreateTexture(string path, string name = "unnamed texture") + { + textureAsset = new Texture2D(resolution, 1, TextureFormat.RGBA32, false); + textureAsset.wrapMode = TextureWrapMode.Clamp; + textureAsset.filterMode = FilterMode.Bilinear; + textureAsset.name = name; + AssetDatabase.AddObjectToAsset(textureAsset, path); + AssetDatabase.Refresh(); + } + + private string EncodeGradient(Gradient gradient) + { + if (gradient == null) return null; + return JsonUtility.ToJson(new GradientRepresentation(gradient)); + } + + private Gradient DecodeGradient(MaterialProperty prop, string name) + { + string json = name.Substring(TextureName(prop).Length); + try + { + return JsonUtility.FromJson(json).ToGradient(); + } + catch (Exception) + { + return null; + } + } + + private Texture2D GetTextureAsset(string path, string name) + { + return AssetDatabase.LoadAllAssetsAtPath(path).FirstOrDefault(asset => asset.name.StartsWith(name)) as Texture2D; + } + + private void BakeGradient(Gradient gradient, Texture2D texture) + { + if (gradient == null) return; + for (int x = 0; x < texture.width; x++) + { + Color color = gradient.Evaluate((float)x / (texture.width - 1)); + for (int y = 0; y < texture.height; y++) texture.SetPixel(x, y, color); + } + texture.Apply(); + } + + [MenuItem("Assets/AllIn1Shader Gradients/Remove All Gradient Textures")] + static void RemoveAllSubassets() + { + foreach(Object asset in Selection.GetFiltered(SelectionMode.Assets)) + { + string path = AssetDatabase.GetAssetPath(asset); + AssetDatabase.ImportAsset(path); + foreach(Object subAsset in AssetDatabase.LoadAllAssetRepresentationsAtPath(path)) + { + Object.DestroyImmediate(subAsset, true); + } + AssetDatabase.ImportAsset(path); + } + } + + class GradientRepresentation + { + public GradientMode mode; + public ColorKey[] colorKeys; + public AlphaKey[] alphaKeys; + + public GradientRepresentation() { } + + public GradientRepresentation(Gradient source) + { + FromGradient(source); + } + + private void FromGradient(Gradient source) + { + mode = source.mode; + colorKeys = source.colorKeys.Select(key => new ColorKey(key)).ToArray(); + alphaKeys = source.alphaKeys.Select(key => new AlphaKey(key)).ToArray(); + } + + private void ToGradient(Gradient gradient) + { + gradient.mode = mode; + gradient.colorKeys = colorKeys.Select(key => key.ToGradientKey()).ToArray(); + gradient.alphaKeys = alphaKeys.Select(key => key.ToGradientKey()).ToArray(); + } + + public Gradient ToGradient() + { + Gradient gradient = new Gradient(); + ToGradient(gradient); + return gradient; + } + + [Serializable] + public struct ColorKey + { + public Color color; + public float time; + + public ColorKey(GradientColorKey source) + { + color = default; + time = default; + FromGradientKey(source); + } + + public void FromGradientKey(GradientColorKey source) + { + color = source.color; + time = source.time; + } + + public GradientColorKey ToGradientKey() + { + GradientColorKey key; + key.color = color; + key.time = time; + return key; + } + } + + [Serializable] + public struct AlphaKey + { + public float alpha; + public float time; + + public AlphaKey(GradientAlphaKey source) + { + alpha = default; + time = default; + FromGradientKey(source); + } + + public void FromGradientKey(GradientAlphaKey source) + { + alpha = source.alpha; + time = source.time; + } + + public GradientAlphaKey ToGradientKey() + { + GradientAlphaKey key; + key.alpha = alpha; + key.time = time; + return key; + } + } + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs.meta new file mode 100644 index 000000000..e6c7eb0c5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: c51263ea47edd3641a26e5f242925bcf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs new file mode 100644 index 000000000..a1f43aaa6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs @@ -0,0 +1,227 @@ +#if UNITY_EDITOR +using System; +using System.IO; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; +using static AllIn1ShaderImporter; + +[InitializeOnLoad] +public static class AllIn1ShaderImporter +{ + public enum UnityVersion + { + NONE = 0, + UNITY_2019 = 1, + UNITY_2020 = 2, + UNITY_2021 = 3, + UNITY_2022 = 4, + UNITY_6 = 5, + } + + public enum RenderPipeline + { + NONE = -1, + BIRP = 0, + URP = 1, + HDRP = 2, + } + + + private const string SHADER_FOLDER_PATH = "../../Shaders/LitShaders"; + private const string FINAL_SHADERS_FOLDER_PATH = "../../Shaders"; + private const string SHADER_TEMPLATE_NAME = @"{0}_{1}.txt"; + + private const string SPRITE_LIT_SHADER_NAME = "AllIn1SpriteShaderLit"; + private const string SPRITE_LIT_TRANSPARENT_SHADER_NAME = "AllIn1SpriteShaderLitTransparent"; + + private const string PIPELINE_SUFFIX_URP_2019 = "BetterShader_URP2019"; + private const string PIPELINE_SUFFIX_HDRP_2019 = "BetterShader_HDRP2019"; + + private const string PIPELINE_SUFFIX_URP_2020 = "BetterShader_URP2020"; + private const string PIPELINE_SUFFIX_HDRP_2020 = "BetterShader_HDRP2020"; + + private const string PIPELINE_SUFFIX_URP_2021 = "BetterShader_URP2021"; + private const string PIPELINE_SUFFIX_HDRP_2021 = "BetterShader_HDRP2021"; + + private const string PIPELINE_SUFFIX_URP_2022 = "BetterShader_URP2022"; + private const string PIPELINE_SUFFIX_HDRP_2022 = "BetterShader_HDRP2022"; + + private const string PIPELINE_SUFFIX_URP_2023 = "BetterShader_URP2023"; + private const string PIPELINE_SUFFIX_HDRP_2023 = "BetterShader_HDRP2023"; + + private const string PIPELINE_SUFFIX_STANDARD = "BetterShader_Standard"; + + private const string LIT_SHADER_PIPELINE_KEY = "AllIn1SpriteShader_LitShader_RenderPipeline"; + private const string LIT_SHADER_UNITY_VERSION_KEY = "AllIn1SpriteShader_LitShader_UnityVersion"; + private const string LIT_SHADER_FIRST_TIME_PROJECT = "AllIn1SpriteShader_LitShader_FirstTimeProject"; + + static AllIn1ShaderImporter() + { + EditorApplication.quitting += Quit; + + ConfigureShaders(); + } + + private static void Quit() + { + EditorPrefs.DeleteKey(LIT_SHADER_FIRST_TIME_PROJECT); + } + + private static void ConfigureShaders() + { + RenderPipelineChecker.RefreshData(); + + UnityVersion unityVersion = GetUnityVersion(); + RenderPipeline renderPipeline = GetRenderPipeline(); + + RenderPipeline lastRenderPipeline = (RenderPipeline)EditorPrefs.GetInt(LIT_SHADER_PIPELINE_KEY, -1); + UnityVersion lastUnityVersion = (UnityVersion)EditorPrefs.GetInt(LIT_SHADER_UNITY_VERSION_KEY, 0); + int firstTimeProject = EditorPrefs.GetInt(LIT_SHADER_FIRST_TIME_PROJECT, -1); + + if (lastRenderPipeline != renderPipeline || lastUnityVersion != unityVersion || firstTimeProject != 1) + { + EditorPrefs.SetInt(LIT_SHADER_PIPELINE_KEY, (int)renderPipeline); + EditorPrefs.SetInt(LIT_SHADER_UNITY_VERSION_KEY, (int)unityVersion); + EditorPrefs.SetInt(LIT_SHADER_FIRST_TIME_PROJECT, 1); + + ConfigureShader(SPRITE_LIT_SHADER_NAME); + ConfigureShader(SPRITE_LIT_TRANSPARENT_SHADER_NAME); + } + } + + private static void ConfigureShader(string shaderName) + { + string pipelineSufix = string.Empty; + + UnityVersion unityVersion = GetUnityVersion(); + RenderPipeline renderPipeline = GetRenderPipeline(); + + if (renderPipeline == RenderPipeline.HDRP) + { + switch (unityVersion) + { + case UnityVersion.UNITY_2019: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2019; + break; + case UnityVersion.UNITY_2020: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2020; + break; + case UnityVersion.UNITY_2021: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2021; + break; + case UnityVersion.UNITY_2022: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2022; + break; + case UnityVersion.UNITY_6: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2023; + break; + + } + } + else if (renderPipeline == RenderPipeline.URP) + { + switch (unityVersion) + { + case UnityVersion.UNITY_2019: + pipelineSufix = PIPELINE_SUFFIX_URP_2019; + break; + case UnityVersion.UNITY_2020: + pipelineSufix = PIPELINE_SUFFIX_URP_2020; + break; + case UnityVersion.UNITY_2021: + pipelineSufix = PIPELINE_SUFFIX_URP_2021; + break; + case UnityVersion.UNITY_2022: + pipelineSufix = PIPELINE_SUFFIX_URP_2022; + break; + case UnityVersion.UNITY_6: + pipelineSufix = PIPELINE_SUFFIX_URP_2023; + break; + } + } + else + { + pipelineSufix = PIPELINE_SUFFIX_STANDARD; + } + + string templateFileName = string.Format(SHADER_TEMPLATE_NAME, shaderName, pipelineSufix); + + string shaderTemplatePath = SHADER_FOLDER_PATH + "/" + templateFileName; + string finalShaderPath = FINAL_SHADERS_FOLDER_PATH + "/" + $"{shaderName}.shader"; + + try + { + var currentFileGUID = AssetDatabase.FindAssets($"t:Script {nameof(AllIn1ShaderImporter)}")[0]; + string currentFolder = Path.GetDirectoryName(AssetDatabase.GUIDToAssetPath(currentFileGUID)); + + string newShaderStr = File.ReadAllText(Path.Combine(currentFolder, shaderTemplatePath)); + newShaderStr = newShaderStr.Replace($"Shader \"AllIn1SpriteShader/{shaderName}_BetterShader\"", $"Shader \"AllIn1SpriteShader/{shaderName}\""); + + File.WriteAllText(Path.Combine(currentFolder, finalShaderPath), newShaderStr); + + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + catch (Exception e) + { + Debug.LogError("Shader not found: " + e); + } + } + + private static UnityVersion GetUnityVersion() + { + UnityVersion res = UnityVersion.NONE; + + string unityVersion = Application.unityVersion; + + if (unityVersion.Contains("2019")) + { + res = UnityVersion.UNITY_2019; + } + else if (unityVersion.Contains("2020")) + { + res = UnityVersion.UNITY_2020; + } + else if (unityVersion.Contains("2021")) + { + res = UnityVersion.UNITY_2021; + } + else if (unityVersion.Contains("2022")) + { + res = UnityVersion.UNITY_2022; + } + else if (unityVersion.Contains("6000")) + { + res = UnityVersion.UNITY_6; + } + + return res; + } + + private static RenderPipeline GetRenderPipeline() + { + RenderPipeline res = RenderPipeline.BIRP; + + if (RenderPipelineChecker.IsURP) + { + res = RenderPipeline.URP; + } + else if (RenderPipelineChecker.IsHDRP) + { + res = RenderPipeline.HDRP; + } + + return res; + } + + public static void ForceReimport() + { + EditorPrefs.DeleteKey(LIT_SHADER_PIPELINE_KEY); + EditorPrefs.DeleteKey(LIT_SHADER_UNITY_VERSION_KEY); + EditorPrefs.DeleteKey(LIT_SHADER_FIRST_TIME_PROJECT); + + ConfigureShaders(); + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs.meta new file mode 100644 index 000000000..fbd3c109b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: aa9d501412652444c8b5b573248c31be +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs new file mode 100644 index 000000000..b21c02678 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs @@ -0,0 +1,324 @@ +#if UNITY_EDITOR +using UnityEditor; +using UnityEngine; +using UnityEngine.UI; +using ShaderType = AllIn1SpriteShader.AllIn1Shader.ShaderTypes; + +namespace AllIn1SpriteShader +{ + [CustomEditor(typeof(AllIn1Shader)), CanEditMultipleObjects] + public class AllIn1ShaderScriptEditor : UnityEditor.Editor + { + private bool showUrpWarning = false; + private double warningTime = 0f; + private SerializedProperty m_NormalStrength, m_NormalSmoothing; + private Texture2D imageInspector; + + private enum ImageType + { + ShowImage, + HideInComponent, + HideEverywhere + } + private ImageType imageType; + + private void OnEnable() + { + m_NormalStrength = serializedObject.FindProperty("normalStrength"); + m_NormalSmoothing = serializedObject.FindProperty("normalSmoothing"); + } + + public override void OnInspectorGUI() + { + ChooseAndDisplayAssetImage(); + + AllIn1Shader myScript = (AllIn1Shader)target; + + SetCurrentShaderType(myScript); + + if (GUILayout.Button("Deactivate All Effects")) + { + for (int i = 0; i < targets.Length; i++) ((AllIn1Shader)targets[i]).ClearAllKeywords(); + AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Deactivated All Effects"); + } + + if (GUILayout.Button("New Clean Material")) + { + bool successOperation = true; + for (int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader)targets[i]).TryCreateNew(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Clean Material"); + } + + + if (GUILayout.Button("Create New Material With Same Properties (SEE DOC)")) + { + bool successOperation = true; + for (int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader)targets[i]).MakeCopy(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Copy Created"); + } + + if (GUILayout.Button("Save Material To Folder (SEE DOC)")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).SaveMaterial(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Material Saved"); + } + + if (GUILayout.Button("Apply Material To All Children")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).ApplyMaterialToHierarchy(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Material Applied To Children"); + else EditorUtility.DisplayDialog("No children found", "All In 1 Shader component couldn't find any children to this GameObject (" + targets[0].name + ")", "Ok"); + } + + if (myScript.currentShaderType != AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + if (GUILayout.Button("Render Material To Image")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).RenderToImage(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Material Rendered To Image"); + } + } + + bool isUrp = false; + Shader temp = AllIn1ShaderWindow.FindShader("AllIn1Urp2dRenderer"); + if (temp != null) isUrp = true; + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Change Shader Variant:", GUILayout.MaxWidth(140)); + int previousShaderType = (int)myScript.currentShaderType; + myScript.currentShaderType = (AllIn1Shader.ShaderTypes)EditorGUILayout.EnumPopup(myScript.currentShaderType); + if (previousShaderType != (int)myScript.currentShaderType) + { + for (int i = 0; i < targets.Length; i++) ((AllIn1Shader)targets[i]).CheckIfValidTarget(); + if (myScript == null) return; + if (isUrp || myScript.currentShaderType != AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + AllIn1ShaderWindow.SceneViewNotificationAndLog(myScript.gameObject.name + " shader variant has been changed to: " + myScript.currentShaderType); + myScript.SetSceneDirty(); + + Renderer sr = myScript.GetComponent(); + if (sr != null) + { + if (sr.sharedMaterial != null) + { + int renderingQueue = sr.sharedMaterial.renderQueue; + if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Default) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShader"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.ScaledTime) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderScaledTime"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.MaskedUI) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderUiMask"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Urp2dRenderer) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1Urp2dRenderer"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Lit) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderLit"); + else SetCurrentShaderType(myScript); + sr.sharedMaterial.renderQueue = renderingQueue; + + if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Lit) + { + sr.sharedMaterial.SetFloat("_ZWrite", 1.0f); + sr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; + sr.receiveShadows = true; + sr.sharedMaterial.renderQueue = 2000; + } + else + { + sr.sharedMaterial.SetFloat("_ZWrite", 0f); + sr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; + sr.receiveShadows = false; + sr.sharedMaterial.renderQueue = 3000; + } + } + } + else + { + Graphic img = myScript.GetComponent(); + if (img != null && img.material != null) + { + int renderingQueue = img.material.renderQueue; + if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Default) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShader"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.ScaledTime) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderScaledTime"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.MaskedUI) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderUiMask"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Urp2dRenderer) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1Urp2dRenderer"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Lit) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderLit"); + else SetCurrentShaderType(myScript); + img.material.renderQueue = renderingQueue; + } + } + } + else if(!isUrp && myScript.currentShaderType == AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + myScript.currentShaderType = (AllIn1Shader.ShaderTypes) previousShaderType; + showUrpWarning = true; + warningTime = EditorApplication.timeSinceStartup + 5; + } + } + } + EditorGUILayout.EndHorizontal(); + + if (warningTime < EditorApplication.timeSinceStartup) showUrpWarning = false; + if (isUrp) showUrpWarning = false; + if (showUrpWarning) EditorGUILayout.HelpBox( + "You can't set the URP 2D Renderer variant since you didn't import the URP package available in the asset root folder (SEE DOCUMENTATION)", + MessageType.Error, + true); + + if ((isUrp && myScript.currentShaderType == AllIn1Shader.ShaderTypes.Urp2dRenderer) || myScript.currentShaderType == AllIn1Shader.ShaderTypes.Lit) + { + EditorGUILayout.Space(); + DrawLine(Color.grey, 1, 3); + EditorGUILayout.Space(); + + if (GUILayout.Button("Create And Add Normal Map")) + { + for (int i = 0; i < targets.Length; i++) ((AllIn1Shader)targets[i]).CreateAndAssignNormalMap(); + AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Creating Normal Map"); + + } + serializedObject.Update(); + EditorGUILayout.PropertyField(m_NormalStrength, new GUIContent("Normal Strength"), GUILayout.Height(20)); + EditorGUILayout.PropertyField(m_NormalSmoothing, new GUIContent("Normal Blur"), GUILayout.Height(20)); + if (myScript.computingNormal) + { + EditorGUILayout.LabelField("Normal Map is currently being created, be patient", EditorStyles.boldLabel, GUILayout.Height(40)); + } + serializedObject.ApplyModifiedProperties(); + + EditorGUILayout.Space(); + } + + DrawLine(Color.grey, 1, 3); + EditorGUILayout.Space(); + + if (GUILayout.Button("Sprite Atlas Auto Setup")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).ToggleSetAtlasUvs(true); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Sprite Atlas Auto Setup"); + } + if (GUILayout.Button("Remove Sprite Atlas Configuration")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).ToggleSetAtlasUvs(false); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Remove Sprite Atlas Configuration"); + } + +#if LETAI_TRUESHADOW + if (myScript.GetComponent() && !myScript.GetComponent()) + { + EditorGUILayout.Space(); + DrawLine(Color.grey, 1, 3); + if (GUILayout.Button("Add True Shadow Compatibility")) + { + myScript.gameObject.AddComponent(); + myScript.SetSceneDirty(); + } + } +#endif + + EditorGUILayout.Space(); + DrawLine(Color.grey, 1, 3); + + if(GUILayout.Button("Remove Component")) + { + for(int i = targets.Length - 1; i >= 0; i--) + { + DestroyImmediate(targets[i] as AllIn1Shader); + ((AllIn1Shader)targets[i]).SetSceneDirty(); + } + AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Component Removed"); + } + + if (GUILayout.Button("REMOVE COMPONENT AND MATERIAL")) + { + for (int i = 0; i < targets.Length; i++) + { + ((AllIn1Shader)targets[i]).CleanMaterial(); + } + for (int i = targets.Length - 1; i >= 0; i--) + { + DestroyImmediate(targets[i] as AllIn1Shader); + } + AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Component And Material Removed"); + } + } + + private void ChooseAndDisplayAssetImage() + { + if(!EditorPrefs.HasKey("allIn1ImageConfig")) + { + EditorPrefs.SetInt("allIn1ImageConfig", (int) ImageType.ShowImage); + } + + imageType = (ImageType) EditorPrefs.GetInt("allIn1ImageConfig"); + switch(imageType) + { + case ImageType.ShowImage: + case ImageType.HideInComponent: + if(imageInspector == null) imageInspector = AllIn1ShaderWindow.GetInspectorImage(); + break; + } + + if(imageInspector && imageType != ImageType.HideInComponent && imageType != ImageType.HideEverywhere && imageInspector) + { + Rect rect = EditorGUILayout.GetControlRect(GUILayout.Height(40)); + GUI.DrawTexture(rect, imageInspector, ScaleMode.ScaleToFit, true); + } + } + + private void SetCurrentShaderType(AllIn1Shader myScript) + { + string shaderName = ""; + Renderer sr = myScript.GetComponent(); + if (sr != null) + { + if(sr.sharedMaterial == null) return; + shaderName = sr.sharedMaterial.shader.name; + } + else + { + Graphic img = myScript.GetComponent(); + if(img.material == null) return; + if (img != null) shaderName = img.material.shader.name; + } + shaderName = shaderName.Replace("AllIn1SpriteShader/", ""); + + if (shaderName.Equals("AllIn1SpriteShader")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.Default; + else if (shaderName.Equals("AllIn1SpriteShaderScaledTime")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.ScaledTime; + else if (shaderName.Equals("AllIn1SpriteShaderUiMask")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.MaskedUI; + else if (shaderName.Equals("AllIn1Urp2dRenderer")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.Urp2dRenderer; + else if(shaderName.Equals("AllIn1SpriteShaderLit")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.Lit; + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs.meta new file mode 100644 index 000000000..30e8877ad --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 78232fc1cf0e9c445a36b7bf7fc49fdb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs new file mode 100644 index 000000000..8e1871d7a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs @@ -0,0 +1,829 @@ +#if UNITY_EDITOR +using System.Linq; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.Rendering; + +[CanEditMultipleObjects] +public class AllIn1SpriteShaderLitMaterialInspector : ShaderGUI +{ + private Material targetMat; + private BlendMode srcMode, dstMode; + private CompareFunction zTestMode = CompareFunction.LessEqual; + private CullMode cullMode; + + private GUIStyle propertiesStyle, bigLabelStyle, smallLabelStyle, toggleButtonStyle; + private const int bigFontSize = 16, smallFontSize = 11; + private string[] oldKeyWords; + private int effectCount = 1; + private Material originalMaterialCopy; + private MaterialEditor matEditor; + private MaterialProperty[] matProperties; + private uint[] materialDrawers = new uint[] { 1, 2, 4 }; + bool[] currEnabledDrawers; + private const uint advancedConfigDrawer = 0; + private const uint colorFxShapeDrawer = 1; + private const uint uvFxShapeDrawer = 2; + + + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + matEditor = materialEditor; + matProperties = properties; + targetMat = materialEditor.target as Material; + effectCount = 1; + oldKeyWords = targetMat.shaderKeywords; + propertiesStyle = new GUIStyle(EditorStyles.helpBox); + propertiesStyle.margin = new RectOffset(0, 0, 0, 0); + bigLabelStyle = new GUIStyle(EditorStyles.boldLabel); + bigLabelStyle.fontSize = bigFontSize; + smallLabelStyle = new GUIStyle(EditorStyles.boldLabel); + smallLabelStyle.fontSize = smallFontSize; + toggleButtonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter, richText = true }; + currEnabledDrawers = new bool[materialDrawers.Length]; + uint iniDrawers = (uint)ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue; + for(int i = 0; i < materialDrawers.Length; i++) currEnabledDrawers[i] = (materialDrawers[i] & iniDrawers) > 0; + + GUILayout.Label("General Properties", bigLabelStyle); + DrawProperty(0); + DrawProperty(1); + //DrawProperty(2); + DrawProperty(70); + + currEnabledDrawers[advancedConfigDrawer] = GUILayout.Toggle(currEnabledDrawers[advancedConfigDrawer], new GUIContent("Show Advanced Configuration"), toggleButtonStyle); + if(currEnabledDrawers[advancedConfigDrawer]) + { + + EditorGUILayout.BeginVertical(propertiesStyle); + Culling(); + DrawLine(Color.grey, 1, 3); + ZTest(); + DrawLine(Color.grey, 1, 3); + ZWrite(); + DrawLine(Color.grey, 1, 3); + Billboard("Billboard active", "BILBOARD_ON"); + DrawLine(Color.grey, 1, 3); + SpriteAtlas("Sprite inside an atlas?", "ATLAS_ON"); + DrawLine(Color.grey, 1, 3); + materialEditor.EnableInstancingField(); + DrawLine(Color.grey, 1, 3); + materialEditor.RenderQueueField(); + EditorGUILayout.EndVertical(); + } + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Light Effect", bigLabelStyle); + GenericEffect("Normal Map", "NORMALMAP_ON", 180, 181); + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Color Effects", bigLabelStyle); + + currEnabledDrawers[colorFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[colorFxShapeDrawer], new GUIContent("Show Color Effects"), toggleButtonStyle); + if(currEnabledDrawers[colorFxShapeDrawer]) + { + Glow("Glow", "GLOW_ON"); + GenericEffect("Fade", "FADE_ON", 7, 13); + Outline("Outline", "OUTBASE_ON"); + GenericEffect("Alpha Outline", "ALPHAOUTLINE_ON", 26, 30, true, "A more performant but less flexible outline"); + InnerOutline("Inner Outline", "INNEROUTLINE_ON", 66, 69); + Gradient("Gradient & Radial Gradient", "GRADIENT_ON"); + GenericEffect("Color Swap", "COLORSWAP_ON", 36, 42, true, "You will need a mask texture (see Documentation)", new int[] { 154 }); + GenericEffect("Hue Shift", "HSV_ON", 43, 45); + ColorChange("Change 1 Color", "CHANGECOLOR_ON"); + ColorRamp("Color Ramp", "COLORRAMP_ON"); + GenericEffect("Hit Effect", "HITEFFECT_ON", 46, 48); + GenericEffect("Negative", "NEGATIVE_ON", 49, 49); + GenericEffect("Pixelate", "PIXELATE_ON", 50, 50, true, "Looks bad with distorition effects"); + GreyScale("GreyScale", "GREYSCALE_ON"); + Posterize("Posterize", "POSTERIZE_ON"); + Blur("Blur", "BLUR_ON"); + GenericEffect("Motion Blur", "MOTIONBLUR_ON", 62, 63); + GenericEffect("Ghost", "GHOST_ON", 64, 65, true, "This effect will not affect the outline", new int[] { 157 }); + GenericEffect("Hologram", "HOLOGRAM_ON", 73, 77, true, null, new int[] { 140, 158 }); + GenericEffect("Chromatic Aberration", "CHROMABERR_ON", 78, 79); + GenericEffect("Glitch", "GLITCH_ON", 80, 80, true, null, new int[] { 139 }); + GenericEffect("Flicker", "FLICKER_ON", 81, 83); + GenericEffect("Shadow", "SHADOW_ON", 84, 87); + GenericEffect("Shine", "SHINE_ON", 133, 138); + GenericEffect("Contrast & Brightness", "CONTRAST_ON", 152, 153); + Overlay("Overlay Texture", "OVERLAY_ON"); + } + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("UV Effects", bigLabelStyle); + + currEnabledDrawers[uvFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[uvFxShapeDrawer], new GUIContent("Show Alpha Effects"), toggleButtonStyle); + if(currEnabledDrawers[uvFxShapeDrawer]) + { + GenericEffect("Hand Drawn", "DOODLE_ON", 88, 89); + Grass("Grass Movement / Wind", "WIND_ON"); + GenericEffect("Wave", "WAVEUV_ON", 94, 98); + GenericEffect("Round Wave", "ROUNDWAVEUV_ON", 127, 128); + GenericEffect("Rect Size (Enable wireframe to see result)", "RECTSIZE_ON", 99, 99, true, "Only on single sprites spritesheets NOT supported"); + GenericEffect("Offset", "OFFSETUV_ON", 100, 101); + GenericEffect("Clipping / Fill Amount", "CLIPPING_ON", 102, 105); + GenericEffect("Radial Clipping / Radial Fill", "RADIALCLIPPING_ON", 164, 166); + GenericEffect("Texture Scroll", "TEXTURESCROLL_ON", 106, 107, true, "Set Texture Wrap Mode to Repeat"); + GenericEffect("Zoom", "ZOOMUV_ON", 108, 108); + GenericEffect("Distortion", "DISTORT_ON", 109, 112); + GenericEffect("Warp Distortion", "WARP_ON", 167, 169); + GenericEffect("Twist", "TWISTUV_ON", 113, 116); + GenericEffect("Rotate", "ROTATEUV_ON", 117, 117, true, "_Tip_ Use Clipping effect to avoid possible undesired parts"); + GenericEffect("Polar Coordinates (Tile texture for good results)", "POLARUV_ON", -1, -1); + GenericEffect("Fish Eye", "FISHEYE_ON", 118, 118); + GenericEffect("Pinch", "PINCH_ON", 119, 119); + GenericEffect("Shake", "SHAKEUV_ON", 120, 122); + } + + SetAndSaveEnabledDrawers(iniDrawers); + } + + private void SetAndSaveEnabledDrawers(uint iniDrawers) + { + uint currDrawers = 0; + for(int i = 0; i < currEnabledDrawers.Length; i++) + { + if(currEnabledDrawers[i]) currDrawers |= materialDrawers[i]; + } + + if(iniDrawers != currDrawers) ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue = currDrawers; + } + + private void Blending() + { + MaterialProperty srcM = ShaderGUI.FindProperty("_MySrcMode", matProperties); + MaterialProperty dstM = ShaderGUI.FindProperty("_MyDstMode", matProperties); + if(srcM.floatValue == 0 && dstM.floatValue == 0) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + } + + GUILayout.Label("This doesn't make much sense in a lit shader", smallLabelStyle); + if(GUILayout.Button("Back To Default Blending")) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + srcMode = (BlendMode)srcM.floatValue; + dstMode = (BlendMode)dstM.floatValue; + srcMode = (BlendMode)EditorGUILayout.EnumPopup("SrcMode", srcMode); + dstMode = (BlendMode)EditorGUILayout.EnumPopup("DstMode", dstMode); + srcM.floatValue = (float)(srcMode); + dstM.floatValue = (float)(dstMode); + + bool ini = oldKeyWords.Contains("PREMULTIPLYALPHA_ON"); + bool toggle = EditorGUILayout.Toggle("Premultiply Alpha?", ini); + if(ini != toggle) Save(); + if(toggle) targetMat.EnableKeyword("PREMULTIPLYALPHA_ON"); + else targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + private void Billboard(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = inspector; + toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + GUILayout.Label("Don't use this feature on UI elements!", smallLabelStyle); + DrawProperty(129, true); + MaterialProperty billboardY = matProperties[129]; + if(billboardY.floatValue == 1) targetMat.EnableKeyword("BILBOARDY_ON"); + else targetMat.DisableKeyword("BILBOARDY_ON"); + } + else targetMat.DisableKeyword(keyword); + } + + private void ZWrite() + { + MaterialProperty zWrite = ShaderGUI.FindProperty("_ZWrite", matProperties); + bool toggle = zWrite.floatValue > 0.9f ? true : false; + EditorGUILayout.BeginHorizontal(); + { + float tempValue = zWrite.floatValue; + toggle = GUILayout.Toggle(toggle, new GUIContent("Enable Z Write")); + if(toggle) zWrite.floatValue = 1.0f; + else zWrite.floatValue = 0.0f; + if(tempValue != zWrite.floatValue && !Application.isPlaying) Save(); + } + EditorGUILayout.EndHorizontal(); + } + + private void ZTest() + { + MaterialProperty zTestM = ShaderGUI.FindProperty("_ZTestMode", matProperties); + float tempValue = zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)EditorGUILayout.EnumPopup("Z TestMode", zTestMode); + zTestM.floatValue = (float)(zTestMode); + if(tempValue != zTestM.floatValue && !Application.isPlaying) Save(); + } + + private void Culling() + { + MaterialProperty cullO = ShaderGUI.FindProperty("_CullingOption", matProperties);; + float tempValue = cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)EditorGUILayout.EnumPopup("Culling Mode", cullMode); + cullO.floatValue = (float)(cullMode); + if(tempValue != cullO.floatValue && !Application.isPlaying) Save(); + } + + private void SpriteAtlas(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + toggle = GUILayout.Toggle(toggle, inspector); + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("Make sure SpriteAtlasUV component is added \n " + + "*Check documentation if unsure what this does or how it works", smallLabelStyle); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + } + + private void Outline(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + ".Outline"; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("OUTBASE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(14); + DrawProperty(15); + DrawProperty(16); + DrawEffectSubKeywordToggle("Outline High Resolution?", "OUTBASE8DIR_ON"); + + DrawLine(Color.grey, 1, 3); + bool outlinePixelPerf = DrawEffectSubKeywordToggle("Outline is Pixel Perfect?", "OUTBASEPIXELPERF_ON"); + if(outlinePixelPerf) DrawProperty(18); + else DrawProperty(17); + + DrawLine(Color.grey, 1, 3); + bool outlineTexture = DrawEffectSubKeywordToggle("Outline uses texture?", "OUTTEX_ON"); + if(outlineTexture) + { + DrawProperty(19); + DrawProperty(20); + DrawProperty(21); + } + + DrawLine(Color.grey, 1, 3); + bool outlineDistort = DrawEffectSubKeywordToggle("Outline uses distortion?", "OUTDIST_ON"); + if(outlineDistort) + { + DrawProperty(22); + DrawProperty(23); + DrawProperty(24); + DrawProperty(25); + } + + DrawLine(Color.grey, 1, 3); + DrawEffectSubKeywordToggle("Only render outline?", "ONLYOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("OUTBASE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GenericEffect(string inspector, string keyword, int first, int last, bool effectCounter = true, string preMessage = null, int[] extraProperties = null, bool boldToggleLetters = true) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + if(effectCounter) + { + effectNameLabel.text = effectCount + "." + inspector; + effectCount++; + } + else effectNameLabel.text = inspector; + if(boldToggleLetters) toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + else toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + if(preMessage != null) GUILayout.Label(preMessage, smallLabelStyle); + for(int i = first; i <= last; i++) DrawProperty(i); + if(extraProperties != null) + foreach(int i in extraProperties) + DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + if(boldToggleLetters) EditorGUILayout.EndToggleGroup(); + } + + private void Glow(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GLOW_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useGlowTex = DrawEffectSubKeywordToggle("Use Glow Texture?", "GLOWTEX_ON"); + if(useGlowTex) DrawProperty(6); + + DrawProperty(3); + DrawProperty(4); + DrawProperty(5, true); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GLOW_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorRamp(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("COLORRAMP_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useEditableGradient = false; + if(AssetDatabase.Contains(targetMat)) + { + useEditableGradient = oldKeyWords.Contains("GRADIENTCOLORRAMP_ON"); + bool gradientTex = useEditableGradient; + gradientTex = GUILayout.Toggle(gradientTex, new GUIContent("Use Editable Gradient?")); + if(useEditableGradient != gradientTex) + { + Save(); + if(gradientTex) + { + useEditableGradient = true; + targetMat.EnableKeyword("GRADIENTCOLORRAMP_ON"); + } + else targetMat.DisableKeyword("GRADIENTCOLORRAMP_ON"); + } + + if(useEditableGradient) matEditor.ShaderProperty(matProperties[159], matProperties[159].displayName); + } + else GUILayout.Label("*Save to folder to allow for dynamic Gradient property", smallLabelStyle); + + if(!useEditableGradient) DrawProperty(51); + + DrawProperty(52); + DrawProperty(53, true); + MaterialProperty colorRampOut = matProperties[53]; + if(colorRampOut.floatValue == 1) targetMat.EnableKeyword("COLORRAMPOUTLINE_ON"); + else targetMat.DisableKeyword("COLORRAMPOUTLINE_ON"); + DrawProperty(155); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("COLORRAMP_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorChange(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("CHANGECOLOR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = 123; i < 127; i++) DrawProperty(i); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR2_ON"); + bool toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 2", ini); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR2_ON"); + for(int i = 146; i < 149; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR2_ON"); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR3_ON"); + toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 3", toggle2); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR3_ON"); + for(int i = 149; i < 152; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR3_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("CHANGECOLOR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GreyScale(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GREYSCALE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(54); + DrawProperty(56); + DrawProperty(55, true); + MaterialProperty greyScaleOut = matProperties[55]; + if(greyScaleOut.floatValue == 1) targetMat.EnableKeyword("GREYSCALEOUTLINE_ON"); + else targetMat.DisableKeyword("GREYSCALEOUTLINE_ON"); + DrawProperty(156); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GREYSCALE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Posterize(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("POSTERIZE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(57); + DrawProperty(58); + DrawProperty(59, true); + MaterialProperty posterizeOut = matProperties[59]; + if(posterizeOut.floatValue == 1) targetMat.EnableKeyword("POSTERIZEOUTLINE_ON"); + else targetMat.DisableKeyword("POSTERIZEOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("POSTERIZE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Blur(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("BLUR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("This effect will not affect the outline", smallLabelStyle); + DrawProperty(60); + DrawProperty(61, true); + MaterialProperty blurIsHd = matProperties[61]; + if(blurIsHd.floatValue == 1) targetMat.EnableKeyword("BLURISHD_ON"); + else targetMat.DisableKeyword("BLURISHD_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("BLUR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Grass(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("WIND_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(90); + DrawProperty(91); + DrawProperty(145); + DrawProperty(92); + DrawProperty(93, true); + MaterialProperty grassManual = matProperties[92]; + if(grassManual.floatValue == 1) targetMat.EnableKeyword("MANUALWIND_ON"); + else targetMat.DisableKeyword("MANUALWIND_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("WIND_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void InnerOutline(string inspector, string keyword, int first, int last) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = first; i <= last; i++) DrawProperty(i); + + EditorGUILayout.Separator(); + DrawProperty(72, true); + MaterialProperty onlyInOutline = matProperties[72]; + if(onlyInOutline.floatValue == 1) targetMat.EnableKeyword("ONLYINNEROUTLINE_ON"); + else targetMat.DisableKeyword("ONLYINNEROUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Gradient(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(143, true); + MaterialProperty gradIsRadial = matProperties[143]; + if(gradIsRadial.floatValue == 1) + { + targetMat.EnableKeyword("RADIALGRADIENT_ON"); + DrawProperty(31); + DrawProperty(32); + DrawProperty(34); + DrawProperty(141); + } + else + { + targetMat.DisableKeyword("RADIALGRADIENT_ON"); + bool simpleGradient = oldKeyWords.Contains("GRADIENT2COL_ON"); + bool simpleGradToggle = EditorGUILayout.Toggle("2 Color Gradient?", simpleGradient); + if(simpleGradient && !simpleGradToggle) targetMat.DisableKeyword("GRADIENT2COL_ON"); + else if(!simpleGradient && simpleGradToggle) targetMat.EnableKeyword("GRADIENT2COL_ON"); + DrawProperty(31); + DrawProperty(32); + if(!simpleGradToggle) DrawProperty(33); + DrawProperty(34); + if(!simpleGradToggle) DrawProperty(35); + if(!simpleGradToggle) DrawProperty(141); + DrawProperty(142); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Overlay(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool multModeOn = oldKeyWords.Contains("OVERLAYMULT_ON"); + bool isMultMode = multModeOn; + isMultMode = GUILayout.Toggle(isMultMode, new GUIContent("Is overlay multiplicative?")); + if(multModeOn != isMultMode) + { + Save(); + if(isMultMode) + { + multModeOn = true; + targetMat.EnableKeyword("OVERLAYMULT_ON"); + } + else targetMat.DisableKeyword("OVERLAYMULT_ON"); + } + + if(multModeOn) GUILayout.Label("Overlay is set to multiplicative mode", smallLabelStyle); + else GUILayout.Label("Overlay is set to additive mode", smallLabelStyle); + + for(int i = 160; i <= 163; i++) DrawProperty(i); + for(int i = 170; i <= 171; i++) DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void DrawProperty(int index, bool noReset = false) + { + MaterialProperty targetProperty = matProperties[index]; + + EditorGUILayout.BeginHorizontal(); + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = targetProperty.displayName; + propertyLabel.tooltip = targetProperty.name + " (C#)"; + + matEditor.ShaderProperty(targetProperty, propertyLabel); + + if(!noReset) + { + GUIContent resetButtonLabel = new GUIContent(); + resetButtonLabel.text = "R"; + resetButtonLabel.tooltip = "Resets to default value"; + if(GUILayout.Button(resetButtonLabel, GUILayout.Width(20))) ResetProperty(targetProperty); + } + } + EditorGUILayout.EndHorizontal(); + } + + private void ResetProperty(MaterialProperty targetProperty) + { + if(originalMaterialCopy == null) originalMaterialCopy = new Material(targetMat.shader); + if(targetProperty.type == MaterialProperty.PropType.Float || targetProperty.type == MaterialProperty.PropType.Range) + { + targetProperty.floatValue = originalMaterialCopy.GetFloat(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Vector) + { + targetProperty.vectorValue = originalMaterialCopy.GetVector(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Color) + { + targetProperty.colorValue = originalMaterialCopy.GetColor(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Texture) + { + targetProperty.textureValue = originalMaterialCopy.GetTexture(targetProperty.name); + } + } + + private bool DrawEffectSubKeywordToggle(string inspector, string keyword, bool setCustomConfigAfter = false) + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = inspector; + propertyLabel.tooltip = keyword + " (C#)"; + + bool ini = oldKeyWords.Contains(keyword); + bool toggle = ini; + toggle = GUILayout.Toggle(toggle, propertyLabel); + if(ini != toggle) + { + if(toggle) targetMat.EnableKeyword(keyword); + else targetMat.DisableKeyword(keyword); + } + + return toggle; + } + + private void Save() + { + if(!Application.isPlaying) EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorUtility.SetDirty(targetMat); + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs.meta new file mode 100644 index 000000000..cfbf2ff88 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 58a451704eab27348bd5177152dc656f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs new file mode 100644 index 000000000..2c2c04473 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs @@ -0,0 +1,828 @@ +#if UNITY_EDITOR +using System.Linq; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.Rendering; + +[CanEditMultipleObjects] +public class AllIn1SpriteShaderMaterialInspector : ShaderGUI +{ + private Material targetMat; + private BlendMode srcMode, dstMode; + private CompareFunction zTestMode = CompareFunction.LessEqual; + private CullMode cullMode; + + private GUIStyle propertiesStyle, bigLabelStyle, smallLabelStyle, toggleButtonStyle; + private const int bigFontSize = 16, smallFontSize = 11; + private string[] oldKeyWords; + private int effectCount = 1; + private Material originalMaterialCopy; + private MaterialEditor matEditor; + private MaterialProperty[] matProperties; + private uint[] materialDrawers = new uint[] { 1, 2, 4 }; + bool[] currEnabledDrawers; + private const uint advancedConfigDrawer = 0; + private const uint colorFxShapeDrawer = 1; + private const uint uvFxShapeDrawer = 2; + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + matEditor = materialEditor; + matProperties = properties; + targetMat = materialEditor.target as Material; + effectCount = 1; + oldKeyWords = targetMat.shaderKeywords; + propertiesStyle = new GUIStyle(EditorStyles.helpBox); + propertiesStyle.margin = new RectOffset(0, 0, 0, 0); + bigLabelStyle = new GUIStyle(EditorStyles.boldLabel); + bigLabelStyle.fontSize = bigFontSize; + smallLabelStyle = new GUIStyle(EditorStyles.boldLabel); + smallLabelStyle.fontSize = smallFontSize; + toggleButtonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter, richText = true }; + currEnabledDrawers = new bool[materialDrawers.Length]; + uint iniDrawers = (uint)ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue; + for(int i = 0; i < materialDrawers.Length; i++) currEnabledDrawers[i] = (materialDrawers[i] & iniDrawers) > 0; + + GUILayout.Label("General Properties", bigLabelStyle); + DrawProperty(0); + DrawProperty(1); + DrawProperty(2); + + + currEnabledDrawers[advancedConfigDrawer] = GUILayout.Toggle(currEnabledDrawers[advancedConfigDrawer], new GUIContent("Show Advanced Configuration"), toggleButtonStyle); + if(currEnabledDrawers[advancedConfigDrawer]) + { + + EditorGUILayout.BeginVertical(propertiesStyle); + Blending(); + DrawLine(Color.grey, 1, 3); + Culling(); + DrawLine(Color.grey, 1, 3); + ZTest(); + DrawLine(Color.grey, 1, 3); + ZWrite(); + DrawLine(Color.grey, 1, 3); + GenericEffect("Unity Fog", "FOG_ON", -1, -1, false, boldToggleLetters: false); + DrawLine(Color.grey, 1, 3); + Billboard("Billboard active", "BILBOARD_ON"); + DrawLine(Color.grey, 1, 3); + SpriteAtlas("Sprite inside an atlas?", "ATLAS_ON"); + DrawLine(Color.grey, 1, 3); + materialEditor.EnableInstancingField(); + DrawLine(Color.grey, 1, 3); + materialEditor.RenderQueueField(); + EditorGUILayout.EndVertical(); + } + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Color Effects", bigLabelStyle); + + currEnabledDrawers[colorFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[colorFxShapeDrawer], new GUIContent("Show Color Effects"), toggleButtonStyle); + if(currEnabledDrawers[colorFxShapeDrawer]) + { + Glow("Glow", "GLOW_ON"); + GenericEffect("Fade", "FADE_ON", 7, 13); + Outline("Outline", "OUTBASE_ON"); + GenericEffect("Alpha Outline", "ALPHAOUTLINE_ON", 26, 30, true, "A more performant but less flexible outline"); + InnerOutline("Inner Outline", "INNEROUTLINE_ON", 66, 69); + Gradient("Gradient & Radial Gradient", "GRADIENT_ON"); + GenericEffect("Color Swap", "COLORSWAP_ON", 36, 42, true, "You will need a mask texture (see Documentation)", new int[] { 154 }); + GenericEffect("Hue Shift", "HSV_ON", 43, 45); + ColorChange("Change 1 Color", "CHANGECOLOR_ON"); + ColorRamp("Color Ramp", "COLORRAMP_ON"); + GenericEffect("Hit Effect", "HITEFFECT_ON", 46, 48); + GenericEffect("Negative", "NEGATIVE_ON", 49, 49); + GenericEffect("Pixelate", "PIXELATE_ON", 50, 50, true, "Looks bad with distorition effects"); + GreyScale("GreyScale", "GREYSCALE_ON"); + Posterize("Posterize", "POSTERIZE_ON"); + Blur("Blur", "BLUR_ON"); + GenericEffect("Motion Blur", "MOTIONBLUR_ON", 62, 63); + GenericEffect("Ghost", "GHOST_ON", 64, 65, true, "This effect will not affect the outline", new int[] { 157 }); + GenericEffect("Hologram", "HOLOGRAM_ON", 73, 77, true, null, new int[] { 140, 158 }); + GenericEffect("Chromatic Aberration", "CHROMABERR_ON", 78, 79); + GenericEffect("Glitch", "GLITCH_ON", 80, 80, true, null, new int[] { 139 }); + GenericEffect("Flicker", "FLICKER_ON", 81, 83); + GenericEffect("Shadow", "SHADOW_ON", 84, 87); + GenericEffect("Shine", "SHINE_ON", 133, 138); + GenericEffect("Contrast & Brightness", "CONTRAST_ON", 152, 153); + Overlay("Overlay Texture", "OVERLAY_ON"); + GenericEffect("Alpha Cutoff", "ALPHACUTOFF_ON", 70, 70); + GenericEffect("Alpha Round", "ALPHAROUND_ON", 144, 144); + } + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("UV Effects", bigLabelStyle); + + currEnabledDrawers[uvFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[uvFxShapeDrawer], new GUIContent("Show Alpha Effects"), toggleButtonStyle); + if(currEnabledDrawers[uvFxShapeDrawer]) + { + GenericEffect("Hand Drawn", "DOODLE_ON", 88, 89); + Grass("Grass Movement / Wind", "WIND_ON"); + GenericEffect("Wave", "WAVEUV_ON", 94, 98); + GenericEffect("Round Wave", "ROUNDWAVEUV_ON", 127, 128); + GenericEffect("Rect Size (Enable wireframe to see result)", "RECTSIZE_ON", 99, 99, true, "Only on single sprites spritesheets NOT supported"); + GenericEffect("Offset", "OFFSETUV_ON", 100, 101); + GenericEffect("Clipping / Fill Amount", "CLIPPING_ON", 102, 105); + GenericEffect("Radial Clipping / Radial Fill", "RADIALCLIPPING_ON", 164, 166); + GenericEffect("Texture Scroll", "TEXTURESCROLL_ON", 106, 107, true, "Set Texture Wrap Mode to Repeat"); + GenericEffect("Zoom", "ZOOMUV_ON", 108, 108); + GenericEffect("Distortion", "DISTORT_ON", 109, 112); + GenericEffect("Warp Distortion", "WARP_ON", 167, 169); + GenericEffect("Twist", "TWISTUV_ON", 113, 116); + GenericEffect("Rotate", "ROTATEUV_ON", 117, 117, true, "_Tip_ Use Clipping effect to avoid possible undesired parts"); + GenericEffect("Polar Coordinates (Tile texture for good results)", "POLARUV_ON", -1, -1); + GenericEffect("Fish Eye", "FISHEYE_ON", 118, 118); + GenericEffect("Pinch", "PINCH_ON", 119, 119); + GenericEffect("Shake", "SHAKEUV_ON", 120, 122); + } + + SetAndSaveEnabledDrawers(iniDrawers); + } + + private void SetAndSaveEnabledDrawers(uint iniDrawers) + { + uint currDrawers = 0; + for(int i = 0; i < currEnabledDrawers.Length; i++) + { + if(currEnabledDrawers[i]) currDrawers |= materialDrawers[i]; + } + + if(iniDrawers != currDrawers) ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue = currDrawers; + } + + private void Blending() + { + MaterialProperty srcM = ShaderGUI.FindProperty("_MySrcMode", matProperties); + MaterialProperty dstM = ShaderGUI.FindProperty("_MyDstMode", matProperties); + if(srcM.floatValue == 0 && dstM.floatValue == 0) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + } + + GUILayout.Label("Look for 'ShaderLab: Blending' if you don't know what this is", smallLabelStyle); + if(GUILayout.Button("Back To Default Blending")) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + srcMode = (BlendMode)srcM.floatValue; + dstMode = (BlendMode)dstM.floatValue; + srcMode = (BlendMode)EditorGUILayout.EnumPopup("SrcMode", srcMode); + dstMode = (BlendMode)EditorGUILayout.EnumPopup("DstMode", dstMode); + srcM.floatValue = (float)(srcMode); + dstM.floatValue = (float)(dstMode); + + bool ini = oldKeyWords.Contains("PREMULTIPLYALPHA_ON"); + bool toggle = EditorGUILayout.Toggle("Premultiply Alpha?", ini); + if(ini != toggle) Save(); + if(toggle) targetMat.EnableKeyword("PREMULTIPLYALPHA_ON"); + else targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + private void Billboard(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = inspector; + toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + GUILayout.Label("Don't use this feature on UI elements!", smallLabelStyle); + DrawProperty(129, true); + MaterialProperty billboardY = matProperties[129]; + if(billboardY.floatValue == 1) targetMat.EnableKeyword("BILBOARDY_ON"); + else targetMat.DisableKeyword("BILBOARDY_ON"); + } + else targetMat.DisableKeyword(keyword); + } + + private void ZWrite() + { + MaterialProperty zWrite = ShaderGUI.FindProperty("_ZWrite", matProperties); + bool toggle = zWrite.floatValue > 0.9f ? true : false; + EditorGUILayout.BeginHorizontal(); + { + float tempValue = zWrite.floatValue; + toggle = GUILayout.Toggle(toggle, new GUIContent("Enable Z Write")); + if(toggle) zWrite.floatValue = 1.0f; + else zWrite.floatValue = 0.0f; + if(tempValue != zWrite.floatValue && !Application.isPlaying) Save(); + } + EditorGUILayout.EndHorizontal(); + } + + private void ZTest() + { + MaterialProperty zTestM = ShaderGUI.FindProperty("_ZTestMode", matProperties); + float tempValue = zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)EditorGUILayout.EnumPopup("Z TestMode", zTestMode); + zTestM.floatValue = (float)(zTestMode); + if(tempValue != zTestM.floatValue && !Application.isPlaying) Save(); + } + + private void Culling() + { + MaterialProperty cullO = ShaderGUI.FindProperty("_CullingOption", matProperties);; + float tempValue = cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)EditorGUILayout.EnumPopup("Culling Mode", cullMode); + cullO.floatValue = (float)(cullMode); + if(tempValue != cullO.floatValue && !Application.isPlaying) Save(); + } + + private void SpriteAtlas(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + toggle = GUILayout.Toggle(toggle, inspector); + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("Make sure SpriteAtlasUV component is added \n " + + "*Check documentation if unsure what this does or how it works", smallLabelStyle); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + } + + private void Outline(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + ".Outline"; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("OUTBASE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(14); + DrawProperty(15); + DrawProperty(16); + DrawEffectSubKeywordToggle("Outline High Resolution?", "OUTBASE8DIR_ON"); + + DrawLine(Color.grey, 1, 3); + bool outlinePixelPerf = DrawEffectSubKeywordToggle("Outline is Pixel Perfect?", "OUTBASEPIXELPERF_ON"); + if(outlinePixelPerf) DrawProperty(18); + else DrawProperty(17); + + DrawLine(Color.grey, 1, 3); + bool outlineTexture = DrawEffectSubKeywordToggle("Outline uses texture?", "OUTTEX_ON"); + if(outlineTexture) + { + DrawProperty(19); + DrawProperty(20); + DrawProperty(21); + } + + DrawLine(Color.grey, 1, 3); + bool outlineDistort = DrawEffectSubKeywordToggle("Outline uses distortion?", "OUTDIST_ON"); + if(outlineDistort) + { + DrawProperty(22); + DrawProperty(23); + DrawProperty(24); + DrawProperty(25); + } + + DrawLine(Color.grey, 1, 3); + DrawEffectSubKeywordToggle("Only render outline?", "ONLYOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("OUTBASE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GenericEffect(string inspector, string keyword, int first, int last, bool effectCounter = true, string preMessage = null, int[] extraProperties = null, bool boldToggleLetters = true) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + if(effectCounter) + { + effectNameLabel.text = effectCount + "." + inspector; + effectCount++; + } + else effectNameLabel.text = inspector; + if(boldToggleLetters) toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + else toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + if(preMessage != null) GUILayout.Label(preMessage, smallLabelStyle); + for(int i = first; i <= last; i++) DrawProperty(i); + if(extraProperties != null) + foreach(int i in extraProperties) + DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + if(boldToggleLetters) EditorGUILayout.EndToggleGroup(); + } + + private void Glow(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GLOW_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useGlowTex = DrawEffectSubKeywordToggle("Use Glow Texture?", "GLOWTEX_ON"); + if(useGlowTex) DrawProperty(6); + + DrawProperty(3); + DrawProperty(4); + DrawProperty(5, true); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GLOW_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorRamp(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("COLORRAMP_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useEditableGradient = false; + if(AssetDatabase.Contains(targetMat)) + { + useEditableGradient = oldKeyWords.Contains("GRADIENTCOLORRAMP_ON"); + bool gradientTex = useEditableGradient; + gradientTex = GUILayout.Toggle(gradientTex, new GUIContent("Use Editable Gradient?")); + if(useEditableGradient != gradientTex) + { + Save(); + if(gradientTex) + { + useEditableGradient = true; + targetMat.EnableKeyword("GRADIENTCOLORRAMP_ON"); + } + else targetMat.DisableKeyword("GRADIENTCOLORRAMP_ON"); + } + + if(useEditableGradient) matEditor.ShaderProperty(matProperties[159], matProperties[159].displayName); + } + else GUILayout.Label("*Save to folder to allow for dynamic Gradient property", smallLabelStyle); + + if(!useEditableGradient) DrawProperty(51); + + DrawProperty(52); + DrawProperty(53, true); + MaterialProperty colorRampOut = matProperties[53]; + if(colorRampOut.floatValue == 1) targetMat.EnableKeyword("COLORRAMPOUTLINE_ON"); + else targetMat.DisableKeyword("COLORRAMPOUTLINE_ON"); + DrawProperty(155); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("COLORRAMP_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorChange(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("CHANGECOLOR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = 123; i < 127; i++) DrawProperty(i); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR2_ON"); + bool toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 2", ini); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR2_ON"); + for(int i = 146; i < 149; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR2_ON"); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR3_ON"); + toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 3", toggle2); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR3_ON"); + for(int i = 149; i < 152; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR3_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("CHANGECOLOR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GreyScale(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GREYSCALE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(54); + DrawProperty(56); + DrawProperty(55, true); + MaterialProperty greyScaleOut = matProperties[55]; + if(greyScaleOut.floatValue == 1) targetMat.EnableKeyword("GREYSCALEOUTLINE_ON"); + else targetMat.DisableKeyword("GREYSCALEOUTLINE_ON"); + DrawProperty(156); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GREYSCALE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Posterize(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("POSTERIZE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(57); + DrawProperty(58); + DrawProperty(59, true); + MaterialProperty posterizeOut = matProperties[59]; + if(posterizeOut.floatValue == 1) targetMat.EnableKeyword("POSTERIZEOUTLINE_ON"); + else targetMat.DisableKeyword("POSTERIZEOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("POSTERIZE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Blur(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("BLUR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("This effect will not affect the outline", smallLabelStyle); + DrawProperty(60); + DrawProperty(61, true); + MaterialProperty blurIsHd = matProperties[61]; + if(blurIsHd.floatValue == 1) targetMat.EnableKeyword("BLURISHD_ON"); + else targetMat.DisableKeyword("BLURISHD_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("BLUR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Grass(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("WIND_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(90); + DrawProperty(91); + DrawProperty(145); + DrawProperty(92); + DrawProperty(93, true); + MaterialProperty grassManual = matProperties[92]; + if(grassManual.floatValue == 1) targetMat.EnableKeyword("MANUALWIND_ON"); + else targetMat.DisableKeyword("MANUALWIND_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("WIND_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void InnerOutline(string inspector, string keyword, int first, int last) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = first; i <= last; i++) DrawProperty(i); + + EditorGUILayout.Separator(); + DrawProperty(72, true); + MaterialProperty onlyInOutline = matProperties[72]; + if(onlyInOutline.floatValue == 1) targetMat.EnableKeyword("ONLYINNEROUTLINE_ON"); + else targetMat.DisableKeyword("ONLYINNEROUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Gradient(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(143, true); + MaterialProperty gradIsRadial = matProperties[143]; + if(gradIsRadial.floatValue == 1) + { + targetMat.EnableKeyword("RADIALGRADIENT_ON"); + DrawProperty(31); + DrawProperty(32); + DrawProperty(34); + DrawProperty(141); + } + else + { + targetMat.DisableKeyword("RADIALGRADIENT_ON"); + bool simpleGradient = oldKeyWords.Contains("GRADIENT2COL_ON"); + bool simpleGradToggle = EditorGUILayout.Toggle("2 Color Gradient?", simpleGradient); + if(simpleGradient && !simpleGradToggle) targetMat.DisableKeyword("GRADIENT2COL_ON"); + else if(!simpleGradient && simpleGradToggle) targetMat.EnableKeyword("GRADIENT2COL_ON"); + DrawProperty(31); + DrawProperty(32); + if(!simpleGradToggle) DrawProperty(33); + DrawProperty(34); + if(!simpleGradToggle) DrawProperty(35); + if(!simpleGradToggle) DrawProperty(141); + DrawProperty(142); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Overlay(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool multModeOn = oldKeyWords.Contains("OVERLAYMULT_ON"); + bool isMultMode = multModeOn; + isMultMode = GUILayout.Toggle(isMultMode, new GUIContent("Is overlay multiplicative?")); + if(multModeOn != isMultMode) + { + Save(); + if(isMultMode) + { + multModeOn = true; + targetMat.EnableKeyword("OVERLAYMULT_ON"); + } + else targetMat.DisableKeyword("OVERLAYMULT_ON"); + } + + if(multModeOn) GUILayout.Label("Overlay is set to multiplicative mode", smallLabelStyle); + else GUILayout.Label("Overlay is set to additive mode", smallLabelStyle); + + for(int i = 160; i <= 163; i++) DrawProperty(i); + for(int i = 170; i <= 171; i++) DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void DrawProperty(int index, bool noReset = false) + { + MaterialProperty targetProperty = matProperties[index]; + + EditorGUILayout.BeginHorizontal(); + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = targetProperty.displayName; + propertyLabel.tooltip = targetProperty.name + " (C#)"; + + matEditor.ShaderProperty(targetProperty, propertyLabel); + + if(!noReset) + { + GUIContent resetButtonLabel = new GUIContent(); + resetButtonLabel.text = "R"; + resetButtonLabel.tooltip = "Resets to default value"; + if(GUILayout.Button(resetButtonLabel, GUILayout.Width(20))) ResetProperty(targetProperty); + } + } + EditorGUILayout.EndHorizontal(); + } + + private void ResetProperty(MaterialProperty targetProperty) + { + if(originalMaterialCopy == null) originalMaterialCopy = new Material(targetMat.shader); + if(targetProperty.type == MaterialProperty.PropType.Float || targetProperty.type == MaterialProperty.PropType.Range) + { + targetProperty.floatValue = originalMaterialCopy.GetFloat(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Vector) + { + targetProperty.vectorValue = originalMaterialCopy.GetVector(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Color) + { + targetProperty.colorValue = originalMaterialCopy.GetColor(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Texture) + { + targetProperty.textureValue = originalMaterialCopy.GetTexture(targetProperty.name); + } + } + + private bool DrawEffectSubKeywordToggle(string inspector, string keyword, bool setCustomConfigAfter = false) + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = inspector; + propertyLabel.tooltip = keyword + " (C#)"; + + bool ini = oldKeyWords.Contains(keyword); + bool toggle = ini; + toggle = GUILayout.Toggle(toggle, propertyLabel); + if(ini != toggle) + { + if(toggle) targetMat.EnableKeyword(keyword); + else targetMat.DisableKeyword(keyword); + } + + return toggle; + } + + private void Save() + { + if(!Application.isPlaying) EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorUtility.SetDirty(targetMat); + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs.meta new file mode 100644 index 000000000..df2eed5b0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: f42211545c188ae41b1e35cc1ce38187 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs new file mode 100644 index 000000000..89abddfc7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs @@ -0,0 +1,758 @@ +#if UNITY_EDITOR +using System.Linq; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.Rendering; + +[CanEditMultipleObjects] +public class AllIn1SpriteShaderUiMaskMaterialInspector : ShaderGUI +{ + private Material targetMat; + private BlendMode srcMode, dstMode; + + private GUIStyle propertiesStyle, bigLabelStyle, smallLabelStyle, toggleButtonStyle; + private const int bigFontSize = 16, smallFontSize = 11; + private string[] oldKeyWords; + private int effectCount = 1; + private Material originalMaterialCopy; + private MaterialEditor matEditor; + private MaterialProperty[] matProperties; + private uint[] materialDrawers = new uint[] { 1, 2, 4 }; + bool[] currEnabledDrawers; + private const uint advancedConfigDrawer = 0; + private const uint colorFxShapeDrawer = 1; + private const uint uvFxShapeDrawer = 2; + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + matEditor = materialEditor; + matProperties = properties; + targetMat = materialEditor.target as Material; + effectCount = 1; + oldKeyWords = targetMat.shaderKeywords; + propertiesStyle = new GUIStyle(EditorStyles.helpBox); + propertiesStyle.margin = new RectOffset(0, 0, 0, 0); + bigLabelStyle = new GUIStyle(EditorStyles.boldLabel); + bigLabelStyle.fontSize = bigFontSize; + smallLabelStyle = new GUIStyle(EditorStyles.boldLabel); + smallLabelStyle.fontSize = smallFontSize; + toggleButtonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter, richText = true }; + currEnabledDrawers = new bool[materialDrawers.Length]; + uint iniDrawers = (uint)ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue; + for(int i = 0; i < materialDrawers.Length; i++) currEnabledDrawers[i] = (materialDrawers[i] & iniDrawers) > 0; + + GUILayout.Label("General Properties", bigLabelStyle); + DrawProperty(0); + DrawProperty(1); + DrawProperty(2); + + + currEnabledDrawers[advancedConfigDrawer] = GUILayout.Toggle(currEnabledDrawers[advancedConfigDrawer], new GUIContent("Show Advanced Configuration"), toggleButtonStyle); + if(currEnabledDrawers[advancedConfigDrawer]) + { + + EditorGUILayout.BeginVertical(propertiesStyle); + Blending(); + DrawLine(Color.grey, 1, 3); + SpriteAtlas("Sprite inside an atlas?", "ATLAS_ON"); + DrawLine(Color.grey, 1, 3); + materialEditor.EnableInstancingField(); + DrawLine(Color.grey, 1, 3); + materialEditor.RenderQueueField(); + EditorGUILayout.EndVertical(); + } + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Color Effects", bigLabelStyle); + + currEnabledDrawers[colorFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[colorFxShapeDrawer], new GUIContent("Show Color Effects"), toggleButtonStyle); + if(currEnabledDrawers[colorFxShapeDrawer]) + { + Glow("Glow", "GLOW_ON"); + GenericEffect("Fade", "FADE_ON", 7, 13); + Outline("Outline", "OUTBASE_ON"); + GenericEffect("Alpha Outline", "ALPHAOUTLINE_ON", 26, 30, true, "A more performant but less flexible outline"); + InnerOutline("Inner Outline", "INNEROUTLINE_ON", 66, 69); + Gradient("Gradient & Radial Gradient", "GRADIENT_ON"); + GenericEffect("Color Swap", "COLORSWAP_ON", 36, 42, true, "You will need a mask texture (see Documentation)", new int[] { 154 }); + GenericEffect("Hue Shift", "HSV_ON", 43, 45); + ColorChange("Change 1 Color", "CHANGECOLOR_ON"); + ColorRamp("Color Ramp", "COLORRAMP_ON"); + GenericEffect("Hit Effect", "HITEFFECT_ON", 46, 48); + GenericEffect("Negative", "NEGATIVE_ON", 49, 49); + GenericEffect("Pixelate", "PIXELATE_ON", 50, 50, true, "Looks bad with distorition effects"); + GreyScale("GreyScale", "GREYSCALE_ON"); + Posterize("Posterize", "POSTERIZE_ON"); + Blur("Blur", "BLUR_ON"); + GenericEffect("Motion Blur", "MOTIONBLUR_ON", 62, 63); + GenericEffect("Ghost", "GHOST_ON", 64, 65, true, "This effect will not affect the outline", new int[] { 157 }); + GenericEffect("Hologram", "HOLOGRAM_ON", 73, 77, true, null, new int[] { 140, 158 }); + GenericEffect("Chromatic Aberration", "CHROMABERR_ON", 78, 79); + GenericEffect("Glitch", "GLITCH_ON", 80, 80, true, null, new int[] { 139 }); + GenericEffect("Flicker", "FLICKER_ON", 81, 83); + GenericEffect("Shadow", "SHADOW_ON", 84, 87); + GenericEffect("Shine", "SHINE_ON", 133, 138); + GenericEffect("Contrast & Brightness", "CONTRAST_ON", 152, 153); + Overlay("Overlay Texture", "OVERLAY_ON"); + GenericEffect("Alpha Cutoff", "ALPHACUTOFF_ON", 70, 70); + GenericEffect("Alpha Round", "ALPHAROUND_ON", 144, 144); + } + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("UV Effects", bigLabelStyle); + + currEnabledDrawers[uvFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[uvFxShapeDrawer], new GUIContent("Show Alpha Effects"), toggleButtonStyle); + if(currEnabledDrawers[uvFxShapeDrawer]) + { + GenericEffect("Hand Drawn", "DOODLE_ON", 88, 89); + Grass("Grass Movement / Wind", "WIND_ON"); + GenericEffect("Wave", "WAVEUV_ON", 94, 98); + GenericEffect("Round Wave", "ROUNDWAVEUV_ON", 127, 128); + GenericEffect("Rect Size (Enable wireframe to see result)", "RECTSIZE_ON", 99, 99, true, "Only on single sprites spritesheets NOT supported"); + GenericEffect("Offset", "OFFSETUV_ON", 100, 101); + GenericEffect("Clipping / Fill Amount", "CLIPPING_ON", 102, 105); + GenericEffect("Radial Clipping / Radial Fill", "RADIALCLIPPING_ON", 164, 166); + GenericEffect("Texture Scroll", "TEXTURESCROLL_ON", 106, 107, true, "Set Texture Wrap Mode to Repeat"); + GenericEffect("Zoom", "ZOOMUV_ON", 108, 108); + GenericEffect("Distortion", "DISTORT_ON", 109, 112); + GenericEffect("Warp Distortion", "WARP_ON", 167, 169); + GenericEffect("Twist", "TWISTUV_ON", 113, 116); + GenericEffect("Rotate", "ROTATEUV_ON", 117, 117, true, "_Tip_ Use Clipping effect to avoid possible undesired parts"); + GenericEffect("Polar Coordinates (Tile texture for good results)", "POLARUV_ON", -1, -1); + GenericEffect("Fish Eye", "FISHEYE_ON", 118, 118); + GenericEffect("Pinch", "PINCH_ON", 119, 119); + GenericEffect("Shake", "SHAKEUV_ON", 120, 122); + } + + SetAndSaveEnabledDrawers(iniDrawers); + } + + private void SetAndSaveEnabledDrawers(uint iniDrawers) + { + uint currDrawers = 0; + for(int i = 0; i < currEnabledDrawers.Length; i++) + { + if(currEnabledDrawers[i]) currDrawers |= materialDrawers[i]; + } + + if(iniDrawers != currDrawers) ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue = currDrawers; + } + + private void Blending() + { + MaterialProperty srcM = ShaderGUI.FindProperty("_MySrcMode", matProperties); + MaterialProperty dstM = ShaderGUI.FindProperty("_MyDstMode", matProperties); + if(srcM.floatValue == 0 && dstM.floatValue == 0) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + } + + GUILayout.Label("Look for 'ShaderLab: Blending' if you don't know what this is", smallLabelStyle); + if(GUILayout.Button("Back To Default Blending")) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + srcMode = (BlendMode)srcM.floatValue; + dstMode = (BlendMode)dstM.floatValue; + srcMode = (BlendMode)EditorGUILayout.EnumPopup("SrcMode", srcMode); + dstMode = (BlendMode)EditorGUILayout.EnumPopup("DstMode", dstMode); + srcM.floatValue = (float)(srcMode); + dstM.floatValue = (float)(dstMode); + + bool ini = oldKeyWords.Contains("PREMULTIPLYALPHA_ON"); + bool toggle = EditorGUILayout.Toggle("Premultiply Alpha?", ini); + if(ini != toggle) Save(); + if(toggle) targetMat.EnableKeyword("PREMULTIPLYALPHA_ON"); + else targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + private void SpriteAtlas(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + toggle = GUILayout.Toggle(toggle, inspector); + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("Make sure SpriteAtlasUV component is added \n " + + "*Check documentation if unsure what this does or how it works", smallLabelStyle); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + } + + private void Outline(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + ".Outline"; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("OUTBASE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(14); + DrawProperty(15); + DrawProperty(16); + DrawEffectSubKeywordToggle("Outline High Resolution?", "OUTBASE8DIR_ON"); + + DrawLine(Color.grey, 1, 3); + bool outlinePixelPerf = DrawEffectSubKeywordToggle("Outline is Pixel Perfect?", "OUTBASEPIXELPERF_ON"); + if(outlinePixelPerf) DrawProperty(18); + else DrawProperty(17); + + DrawLine(Color.grey, 1, 3); + bool outlineTexture = DrawEffectSubKeywordToggle("Outline uses texture?", "OUTTEX_ON"); + if(outlineTexture) + { + DrawProperty(19); + DrawProperty(20); + DrawProperty(21); + } + + DrawLine(Color.grey, 1, 3); + bool outlineDistort = DrawEffectSubKeywordToggle("Outline uses distortion?", "OUTDIST_ON"); + if(outlineDistort) + { + DrawProperty(22); + DrawProperty(23); + DrawProperty(24); + DrawProperty(25); + } + + DrawLine(Color.grey, 1, 3); + DrawEffectSubKeywordToggle("Only render outline?", "ONLYOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("OUTBASE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GenericEffect(string inspector, string keyword, int first, int last, bool effectCounter = true, string preMessage = null, int[] extraProperties = null, bool boldToggleLetters = true) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + if(effectCounter) + { + effectNameLabel.text = effectCount + "." + inspector; + effectCount++; + } + else effectNameLabel.text = inspector; + if(boldToggleLetters) toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + else toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + if(preMessage != null) GUILayout.Label(preMessage, smallLabelStyle); + for(int i = first; i <= last; i++) DrawProperty(i); + if(extraProperties != null) + foreach(int i in extraProperties) + DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + if(boldToggleLetters) EditorGUILayout.EndToggleGroup(); + } + + private void Glow(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GLOW_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useGlowTex = DrawEffectSubKeywordToggle("Use Glow Texture?", "GLOWTEX_ON"); + if(useGlowTex) DrawProperty(6); + + DrawProperty(3); + DrawProperty(4); + DrawProperty(5, true); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GLOW_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorRamp(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("COLORRAMP_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useEditableGradient = false; + if(AssetDatabase.Contains(targetMat)) + { + useEditableGradient = oldKeyWords.Contains("GRADIENTCOLORRAMP_ON"); + bool gradientTex = useEditableGradient; + gradientTex = GUILayout.Toggle(gradientTex, new GUIContent("Use Editable Gradient?")); + if(useEditableGradient != gradientTex) + { + Save(); + if(gradientTex) + { + useEditableGradient = true; + targetMat.EnableKeyword("GRADIENTCOLORRAMP_ON"); + } + else targetMat.DisableKeyword("GRADIENTCOLORRAMP_ON"); + } + + if(useEditableGradient) matEditor.ShaderProperty(matProperties[159], matProperties[159].displayName); + } + else GUILayout.Label("*Save to folder to allow for dynamic Gradient property", smallLabelStyle); + + if(!useEditableGradient) DrawProperty(51); + + DrawProperty(52); + DrawProperty(53, true); + MaterialProperty colorRampOut = matProperties[53]; + if(colorRampOut.floatValue == 1) targetMat.EnableKeyword("COLORRAMPOUTLINE_ON"); + else targetMat.DisableKeyword("COLORRAMPOUTLINE_ON"); + DrawProperty(155); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("COLORRAMP_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorChange(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("CHANGECOLOR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = 123; i < 127; i++) DrawProperty(i); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR2_ON"); + bool toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 2", ini); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR2_ON"); + for(int i = 146; i < 149; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR2_ON"); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR3_ON"); + toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 3", toggle2); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR3_ON"); + for(int i = 149; i < 152; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR3_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("CHANGECOLOR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GreyScale(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GREYSCALE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(54); + DrawProperty(56); + DrawProperty(55, true); + MaterialProperty greyScaleOut = matProperties[55]; + if(greyScaleOut.floatValue == 1) targetMat.EnableKeyword("GREYSCALEOUTLINE_ON"); + else targetMat.DisableKeyword("GREYSCALEOUTLINE_ON"); + DrawProperty(156); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GREYSCALE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Posterize(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("POSTERIZE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(57); + DrawProperty(58); + DrawProperty(59, true); + MaterialProperty posterizeOut = matProperties[59]; + if(posterizeOut.floatValue == 1) targetMat.EnableKeyword("POSTERIZEOUTLINE_ON"); + else targetMat.DisableKeyword("POSTERIZEOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("POSTERIZE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Blur(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("BLUR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("This effect will not affect the outline", smallLabelStyle); + DrawProperty(60); + DrawProperty(61, true); + MaterialProperty blurIsHd = matProperties[61]; + if(blurIsHd.floatValue == 1) targetMat.EnableKeyword("BLURISHD_ON"); + else targetMat.DisableKeyword("BLURISHD_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("BLUR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Grass(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("WIND_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(90); + DrawProperty(91); + DrawProperty(145); + DrawProperty(92); + DrawProperty(93, true); + MaterialProperty grassManual = matProperties[92]; + if(grassManual.floatValue == 1) targetMat.EnableKeyword("MANUALWIND_ON"); + else targetMat.DisableKeyword("MANUALWIND_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("WIND_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void InnerOutline(string inspector, string keyword, int first, int last) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = first; i <= last; i++) DrawProperty(i); + + EditorGUILayout.Separator(); + DrawProperty(72, true); + MaterialProperty onlyInOutline = matProperties[72]; + if(onlyInOutline.floatValue == 1) targetMat.EnableKeyword("ONLYINNEROUTLINE_ON"); + else targetMat.DisableKeyword("ONLYINNEROUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Gradient(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(143, true); + MaterialProperty gradIsRadial = matProperties[143]; + if(gradIsRadial.floatValue == 1) + { + targetMat.EnableKeyword("RADIALGRADIENT_ON"); + DrawProperty(31); + DrawProperty(32); + DrawProperty(34); + DrawProperty(141); + } + else + { + targetMat.DisableKeyword("RADIALGRADIENT_ON"); + bool simpleGradient = oldKeyWords.Contains("GRADIENT2COL_ON"); + bool simpleGradToggle = EditorGUILayout.Toggle("2 Color Gradient?", simpleGradient); + if(simpleGradient && !simpleGradToggle) targetMat.DisableKeyword("GRADIENT2COL_ON"); + else if(!simpleGradient && simpleGradToggle) targetMat.EnableKeyword("GRADIENT2COL_ON"); + DrawProperty(31); + DrawProperty(32); + if(!simpleGradToggle) DrawProperty(33); + DrawProperty(34); + if(!simpleGradToggle) DrawProperty(35); + if(!simpleGradToggle) DrawProperty(141); + DrawProperty(142); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Overlay(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool multModeOn = oldKeyWords.Contains("OVERLAYMULT_ON"); + bool isMultMode = multModeOn; + isMultMode = GUILayout.Toggle(isMultMode, new GUIContent("Is overlay multiplicative?")); + if(multModeOn != isMultMode) + { + Save(); + if(isMultMode) + { + multModeOn = true; + targetMat.EnableKeyword("OVERLAYMULT_ON"); + } + else targetMat.DisableKeyword("OVERLAYMULT_ON"); + } + + if(multModeOn) GUILayout.Label("Overlay is set to multiplicative mode", smallLabelStyle); + else GUILayout.Label("Overlay is set to additive mode", smallLabelStyle); + + for(int i = 160; i <= 163; i++) DrawProperty(i); + for(int i = 170; i <= 171; i++) DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void DrawProperty(int index, bool noReset = false) + { + MaterialProperty targetProperty = matProperties[index]; + + EditorGUILayout.BeginHorizontal(); + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = targetProperty.displayName; + propertyLabel.tooltip = targetProperty.name + " (C#)"; + + matEditor.ShaderProperty(targetProperty, propertyLabel); + + if(!noReset) + { + GUIContent resetButtonLabel = new GUIContent(); + resetButtonLabel.text = "R"; + resetButtonLabel.tooltip = "Resets to default value"; + if(GUILayout.Button(resetButtonLabel, GUILayout.Width(20))) ResetProperty(targetProperty); + } + } + EditorGUILayout.EndHorizontal(); + } + + private void ResetProperty(MaterialProperty targetProperty) + { + if(originalMaterialCopy == null) originalMaterialCopy = new Material(targetMat.shader); + if(targetProperty.type == MaterialProperty.PropType.Float || targetProperty.type == MaterialProperty.PropType.Range) + { + targetProperty.floatValue = originalMaterialCopy.GetFloat(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Vector) + { + targetProperty.vectorValue = originalMaterialCopy.GetVector(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Color) + { + targetProperty.colorValue = originalMaterialCopy.GetColor(targetProperty.name); + } + else if(targetProperty.type == MaterialProperty.PropType.Texture) + { + targetProperty.textureValue = originalMaterialCopy.GetTexture(targetProperty.name); + } + } + + private bool DrawEffectSubKeywordToggle(string inspector, string keyword, bool setCustomConfigAfter = false) + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = inspector; + propertyLabel.tooltip = keyword + " (C#)"; + + bool ini = oldKeyWords.Contains(keyword); + bool toggle = ini; + toggle = GUILayout.Toggle(toggle, propertyLabel); + if(ini != toggle) + { + if(toggle) targetMat.EnableKeyword(keyword); + else targetMat.DisableKeyword(keyword); + } + + return toggle; + } + + private void Save() + { + if(!Application.isPlaying) EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorUtility.SetDirty(targetMat); + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs.meta new file mode 100644 index 000000000..4150b48b7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: bcdb12210426bb34cb44a19ffb54132d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs new file mode 100644 index 000000000..fe97a06d0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs @@ -0,0 +1,74 @@ +////////////////////////////////////////////////////// +// Shader Packager +// Copyright (c) Jason Booth +////////////////////////////////////////////////////// + +using System; +using System.Linq; +using System.Reflection; +using System.Collections.Generic; +using UnityEditor; + +#if UNITY_2019_3_OR_NEWER + +// installs defines for render pipelines, so we can #if USING_HDRP and do stuff. Can't believe Unity doesn't provide this crap, they +// really go out of their way to make it hard to work across pipelines. + +public static class RenderPipelineChecker +{ + private const string HDRP_PACKAGE = "HDRenderPipelineAsset"; + private const string URP_PACKAGE = "UniversalRenderPipelineAsset"; + + public static bool IsHDRP + { + get; private set; + } + public static bool IsURP + { + get; private set; + } + public static bool IsStandardRP + { + get; private set; + } + + public static void RefreshData() + { + IsHDRP = DoesTypeExist(HDRP_PACKAGE); + IsURP = DoesTypeExist(URP_PACKAGE); + + if (!(IsHDRP || IsURP)) + { + IsStandardRP = true; + } + + } + + public static bool DoesTypeExist(string className) + { + var foundType = (from assembly in AppDomain.CurrentDomain.GetAssemblies() + from type in GetTypesSafe(assembly) + where type.Name == className + select type).FirstOrDefault(); + + return foundType != null; + } + + public static IEnumerable GetTypesSafe(System.Reflection.Assembly assembly) + { + Type[] types; + + try + { + types = assembly.GetTypes(); + } + catch (ReflectionTypeLoadException e) + { + types = e.Types; + } + + return types.Where(x => x != null); + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs.meta new file mode 100644 index 000000000..29af04f2e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 83ac30b66f3fe444189a98a9bb648c51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs new file mode 100644 index 000000000..e933c8be7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs @@ -0,0 +1,37 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace AllIn1SpriteShader +{ + public class RandomSeed : MonoBehaviour + { + private readonly int randomSeedProperty = Shader.PropertyToID("_RandomSeed"); + private MaterialPropertyBlock propertyBlock; + + //If you want to randomize UI Images, you'll need to create different materials since materials are always shared + //This can be done at runtime with scripting or manually in the editor + private void Start() + { + Renderer renderer = GetComponent(); + if(renderer != null) + { + propertyBlock = new MaterialPropertyBlock(); + propertyBlock.SetFloat(randomSeedProperty, Random.Range(0f, 100f)); + renderer.SetPropertyBlock(propertyBlock); + } + else + { + Image image = GetComponent(); + if (image != null) + { + if (image.material != null) + { + image.material.SetFloat(randomSeedProperty, Random.Range(0, 1000f)); + } + else Debug.LogError("Missing Material on UI Image: " + gameObject.name); + } + else Debug.LogError("Missing Renderer or UI Image on: " + gameObject.name); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs.meta new file mode 100644 index 000000000..b560feb37 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 6078fd4d3c5bd6f4087f8869458662dd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs new file mode 100644 index 000000000..25260a946 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs @@ -0,0 +1,179 @@ +using UnityEngine; +using UnityEngine.UI; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace AllIn1SpriteShader +{ + [ExecuteInEditMode] + public class SetAtlasUvs : MonoBehaviour + { + [SerializeField] private bool updateEveryFrame = false; + [Tooltip("If using a Sprite Renderer it will use the material property instead of sharedMaterial"), SerializeField] private bool useMaterialInstanceIfPossible = false; + private Renderer render; + private SpriteRenderer spriteRender; + private Image uiImage; + private bool isUI = false; + private readonly int minXuv = Shader.PropertyToID("_MinXUV"); + private readonly int maxXuv = Shader.PropertyToID("_MaxXUV"); + private readonly int minYuv = Shader.PropertyToID("_MinYUV"); + private readonly int maxYuv = Shader.PropertyToID("_MaxYUV"); + + private void Start() + { + Setup(); + } + + private void Reset() + { + Setup(); + } + + private void Setup() + { + if (GetRendererReferencesIfNeeded()) GetAndSetUVs(); + if (!updateEveryFrame && Application.isPlaying && this != null) this.enabled = false; + } + + private void Update() + { + if (updateEveryFrame) + { + GetAndSetUVs(); + } + } + + public bool GetAndSetUVs() + { + if (!GetRendererReferencesIfNeeded()) return false; + + if (!isUI) + { + Sprite sprite = spriteRender.sprite; + Rect r = sprite.textureRect; + r.x /= sprite.texture.width; + r.width /= sprite.texture.width; + r.y /= sprite.texture.height; + r.height /= sprite.texture.height; + + if(useMaterialInstanceIfPossible && Application.isPlaying) + { + render.material.SetFloat(minXuv, r.xMin); + render.material.SetFloat(maxXuv, r.xMax); + render.material.SetFloat(minYuv, r.yMin); + render.material.SetFloat(maxYuv, r.yMax); + } + else + { + render.sharedMaterial.SetFloat(minXuv, r.xMin); + render.sharedMaterial.SetFloat(maxXuv, r.xMax); + render.sharedMaterial.SetFloat(minYuv, r.yMin); + render.sharedMaterial.SetFloat(maxYuv, r.yMax); + } + } + else + { + Rect r = uiImage.sprite.textureRect; + r.x /= uiImage.sprite.texture.width; + r.width /= uiImage.sprite.texture.width; + r.y /= uiImage.sprite.texture.height; + r.height /= uiImage.sprite.texture.height; + + uiImage.material.SetFloat(minXuv, r.xMin); + uiImage.material.SetFloat(maxXuv, r.xMax); + uiImage.material.SetFloat(minYuv, r.yMin); + uiImage.material.SetFloat(maxYuv, r.yMax); + } + + return true; + } + + public void ResetAtlasUvs() + { + if (!GetRendererReferencesIfNeeded()) return; + + if (!isUI) + { + if(useMaterialInstanceIfPossible && Application.isPlaying) + { + render.material.SetFloat(minXuv, 0f); + render.material.SetFloat(maxXuv, 1f); + render.material.SetFloat(minYuv, 0f); + render.material.SetFloat(maxYuv, 1f); + } + else + { + render.sharedMaterial.SetFloat(minXuv, 0f); + render.sharedMaterial.SetFloat(maxXuv, 1f); + render.sharedMaterial.SetFloat(minYuv, 0f); + render.sharedMaterial.SetFloat(maxYuv, 1f); + } + } + else + { + uiImage.material.SetFloat(minXuv, 0f); + uiImage.material.SetFloat(maxXuv, 1f); + uiImage.material.SetFloat(minYuv, 0f); + uiImage.material.SetFloat(maxYuv, 1f); + } + } + + public void UpdateEveryFrame(bool everyFrame) + { + updateEveryFrame = everyFrame; + } + + private bool GetRendererReferencesIfNeeded() + { + if (spriteRender == null) spriteRender = GetComponent(); + if (spriteRender != null) + { + if (spriteRender.sprite == null) + { + #if UNITY_EDITOR + EditorUtility.DisplayDialog("No sprite found", "The object: " + gameObject.name + ", has Sprite Renderer but no sprite", "Ok"); + #endif + DestroyImmediate(this); + return false; + } + if (render == null) render = GetComponent(); + isUI = false; + } + else + { + if (uiImage == null) + { + uiImage = GetComponent(); + if (uiImage != null) + { + #if UNITY_EDITOR + Debug.Log("You added the SetAtlasUv component to: " + gameObject.name + " that has a UI Image\n " + + "This SetAtlasUV component will only work properly on UI Images if each Image has a DIFFERENT material instance (See Documentation Sprite Atlases section for more info)"); + #endif + } + else + { + #if UNITY_EDITOR + EditorUtility.DisplayDialog("No Renderer or UI Graphic found", "This SetAtlasUV component will now get destroyed", "Ok"); + #endif + DestroyImmediate(this); + return false; + } + } + if (render == null) render = GetComponent(); + isUI = true; + } + + if (spriteRender == null && uiImage == null) + { + #if UNITY_EDITOR + EditorUtility.DisplayDialog("No Renderer or UI Graphic found", "This SetAtlasUV component will now get destroyed", "Ok"); + #endif + DestroyImmediate(this); + return false; + } + return true; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs.meta new file mode 100644 index 000000000..47983ca73 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 1625263d85e5d554284989eb9052e863 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs new file mode 100644 index 000000000..a8ea13a19 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + //This script is made with Unity version 2019 and onward in mind + //If you are in Unity 2018 or previous you probably want to use SetGlobalTimeUnity2018.cs instead + + //This script will pass in the Unscaled Time to the shader to animate the effects even when the game is paused + //Set shaders to Scaled Time variant and add this script to an active GameObject to see the results + //Video tutorial about it: https://youtu.be/7_BggIufV-w + [ExecuteInEditMode] + public class SetGlobalTimeNew : MonoBehaviour + { + int globalTime; + + void Start() + { + globalTime = Shader.PropertyToID("globalUnscaledTime"); + } + + void Update() + { + Shader.SetGlobalFloat(globalTime, Time.unscaledTime / 20f); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs.meta new file mode 100644 index 000000000..2b22cf6ec --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: c6c0770c7b77d3f45ab8c8d42b794c51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeNew.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs new file mode 100644 index 000000000..31578f5f5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + //This script is made with Unity version 2018 and previous ones in mind + //If you are in Unity 2019 or onward you probably want to use SetGlobalTimeNew.cs instead + + //This script will pass in the Scaled Time to the shader so the effects stop being animated when the game is paused + //Set shaders to Scaled Time variant and add this script to an active GameObject to see the results + //Video tutorial about it: https://youtu.be/7_BggIufV-w + [ExecuteInEditMode] + public class SetGlobalTimeUnity2018 : MonoBehaviour + { + int globalTime; + + void Start() + { + globalTime = Shader.PropertyToID("globalUnscaledTime"); + } + + void Update() + { + Shader.SetGlobalFloat(globalTime, Time.time / 20f); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs.meta new file mode 100644 index 000000000..a4d805ff2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: ee7031a07aea7674fad9a0795b193f56 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTimeUnity2018.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture.meta new file mode 100644 index 000000000..e1631cb10 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30ea7cd4d865fef46b7a1ea7e98943a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png new file mode 100644 index 000000000..f7a4da5a5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6903456b88c70a6cbba6cceffa74aa65f5f65dd18fa1f74eaf33c30ffe149cad +size 31774 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png.meta new file mode 100644 index 000000000..b04fc18e1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png.meta @@ -0,0 +1,99 @@ +fileFormatVersion: 2 +guid: 917b41800d6604d4e99bef50da598d65 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 692da10dc1b5aa741a39ec794b64c334 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs new file mode 100644 index 000000000..c4c051d8c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs @@ -0,0 +1,39 @@ +#if LETAI_TRUESHADOW +using LeTai.TrueShadow; +using LeTai.TrueShadow.PluginInterfaces; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + [ExecuteAlways] + public class TrueShadowCompatibility : MonoBehaviour, ITrueShadowCustomHashProvider + { + [Tooltip("Use with animated effects")] + public bool updateTrueShadowEveryFrame = false; + private TrueShadow shadow; + + public void UpdateTrueShadow() + { + if (!shadow) shadow = GetComponent(); + if (!shadow) return; + + UpdateTrueShadow(shadow); + } + + public static void UpdateTrueShadow(TrueShadow shadow) + { + shadow.CustomHash = Random.Range(int.MinValue, int.MaxValue); + } + + public void Update() + { + bool shouldDirty = updateTrueShadowEveryFrame; +#if UNITY_EDITOR + shouldDirty |= !Application.isPlaying; +#endif + if (shouldDirty) + UpdateTrueShadow(); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs.meta new file mode 100644 index 000000000..be1248bb8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 279c59909b723da49b1f2cf62d25b06a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders.meta new file mode 100644 index 000000000..5d56747a6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42ce74ee1ab07574bbe2c76ca27d7c20 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc new file mode 100644 index 000000000..06a1e55f6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc @@ -0,0 +1,71 @@ +//Prevent Unity warnings that are not relevant for this shader------------------- +#pragma warning (disable : 3571) // pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them +#pragma warning (disable : 4008) // floating point division by zero +#pragma warning (disable : 3206) // implicit truncation of vector type +//BLURS------------------------------------------------------------------------- +half4 Blur(half2 uv, sampler2D source, half Intensity) +{ + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = tex2D(source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = tex2D(source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; +} + +half BlurHD_G(half bhqp, half x) +{ + return exp(-(x * x) / (2.0 * bhqp * bhqp)); +} +half4 BlurHD(half2 uv, sampler2D source, half BlurAmount, half xScale, half yScale) +{ + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += tex2D(source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; +} +//----------------------------------------------------------------------- +half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; +} + +half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; +} + +half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; +} +//----------------------------------------------------------------------- +half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc.meta new file mode 100644 index 000000000..eac00e81e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: df06cdcb3555be745b54ff3003fa687e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader new file mode 100644 index 000000000..9aa8ba06b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader @@ -0,0 +1,1234 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShader" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + Tags { "Queue" = "Transparent" "CanUseSpriteAtlas" = "True" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + Pass + { + CGPROGRAM + #pragma multi_compile_instancing + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHAROUND_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature ATLAS_ON + #pragma shader_feature PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + #pragma shader_feature FOG_ON + + #include "UnityCG.cginc" + #include "AllIn1OneShaderFunctions.cginc" + + #if FOG_ON + #pragma multi_compile_fog + #endif + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD3; + #endif + #if FOG_ON + UNITY_FOG_COORDS(4) + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + sampler2D _MainTex; + half4 _MainTex_ST, _MainTex_TexelSize, _Color; + half _Alpha; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if FADE_ON + sampler2D _FadeTex, _FadeBurnTex; + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if GLOW_ON + sampler2D _GlowTex; + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + sampler2D _OutlineTex; + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + sampler2D _OutlineDistortTex; + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if DISTORT_ON + sampler2D _DistortTex; + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + sampler2D _ColorSwapTex; + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if COLORRAMP_ON + sampler2D _ColorRampTex, _ColorRampTexGradient; + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + sampler2D _ShineMask; + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if ALPHACUTOFF_ON + half _AlphaCutoffValue; + #endif + + #if ALPHAROUND_ON + half _AlphaRoundThreshold; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + sampler2D _OverlayTex; + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + UNITY_INSTANCING_BUFFER_START(Props) + UNITY_DEFINE_INSTANCED_PROP(float, _RandomSeed) + UNITY_INSTANCING_BUFFER_END(Props) + + v2f vert (appdata v) + { + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + o.vertex = UnityObjectToClipPos(half4(localPos, 1)); + #else + o.vertex = UnityObjectToClipPos(v.vertex); + #endif + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = TRANSFORM_TEX(v.uv, _OutlineTex); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = TRANSFORM_TEX(v.uv, _OutlineDistortTex); + #endif + + #if DISTORT_ON + o.uvDistTex = TRANSFORM_TEX(v.uv, _DistortTex); + #endif + + #if FOG_ON + UNITY_TRANSFER_FOG(o,o.vertex); + #endif + + return o; + } + + half3 GetPixel(in int offsetX, in int offsetY, half2 uv, sampler2D tex) + { + return tex2D(tex, (uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y))).rgb; + } + + half4 frag (v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ST.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((_Time.x + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((_Time.x + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (tex2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = tex2D(_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = tex2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = tex2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = tex2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = tex2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = i.uv; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = tex2D(_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + i.uvOutDistTex.x += ((_Time.x + randomSeed) * _OutlineDistortTexXSpeed) % 1; + i.uvOutDistTex.y += ((_Time.x + randomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutDistTex = half2((i.uvOutDistTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutDistTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (tex2D(_OutlineDistortTex, i.uvOutDistTex).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = tex2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = tex2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = tex2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = tex2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = tex2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = tex2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = tex2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = tex2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((_Time.x + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((_Time.x + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = tex2D(_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= TRANSFORM_TEX(i.uv, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(i.uv, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = tex2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * tex2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = tex2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = tex2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = tex2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + + #if FOG_ON + UNITY_APPLY_FOG(i.fogCoord, col); + #endif + + return col; + } + ENDCG + } + } + CustomEditor "AllIn1SpriteShaderMaterialInspector" + //Fallback "Sprites/Default" //Remove fallback so that any shader error is obvious to the user +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader.meta new file mode 100644 index 000000000..c969acb01 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: a36b7719ff0465b42ab1407d67672c5f +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _GlowTex: {instanceID: 0} + - _FadeTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _FadeBurnTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + - _OutlineTex: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + - _OutlineDistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, + type: 3} + - _ColorSwapTex: {instanceID: 0} + - _ColorRampTex: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + - _DistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ShineMask: {instanceID: 0} + - _ColorRampTexGradient: {instanceID: 0} + - _OverlayTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader new file mode 100644 index 000000000..65a695a5a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader @@ -0,0 +1,17700 @@ +// Upgrade NOTE: replaced 'defined FOG_COMBINED_WITH_WORLD_POS' with 'defined (FOG_COMBINED_WITH_WORLD_POS)' + +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: Standard +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + } + SubShader + { + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" } + + + + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + // compile directives + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma multi_compile_fwdbase + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + // -------- variant for: + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + #define SHADER_PASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + float4 lmap : TEXCOORD8; + #if UNITY_SHOULD_SAMPLE_SH + half3 sh : TEXCOORD9; // SH + #endif + #ifdef LIGHTMAP_ON + UNITY_LIGHTING_COORDS(10,11) + UNITY_FOG_COORDS(12) + #else + UNITY_FOG_COORDS(10) + UNITY_SHADOW_COORDS(11) + #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + // SH/ambient and vertex lights + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + // Approximated illumination from non-important point lights + #ifdef VERTEXLIGHT_ON + o.sh += 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, o.worldPos, o.worldNormal); + #endif + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif // !LIGHTMAP_ON + + UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader + #else + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + // compute lighting & shadowing factor + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.Specular; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + fixed4 c = 0; + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + giInput.light.color *= mulColor; + #endif + + #if _UNLIT + c.rgb = l.Albedo; + c.a = l.Alpha; + #elif _BDRF3 || _SIMPLELIT + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandardSpecular (o, d.worldSpaceViewDir, gi); + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandard (o, d.worldSpaceViewDir, gi); + #endif + + c.rgb += o.Emission; + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + + + return c; + } + + ENDCG + + } + + + + // ---- deferred shading pass: + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma exclude_renderers nomrt + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_prepassfinal + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifndef DIRLIGHTMAP_OFF + float3 viewDir : TEXCOORD8; + #endif + float4 lmap : TEXCOORD9; + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + half3 sh : TEXCOORD10; // SH + #endif + #else + #ifdef DIRLIGHTMAP_OFF + float4 lmapFadePos : TEXCOORD11; + #endif + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + float3 viewDirForLight = UnityWorldSpaceViewDir(o.worldPos); + #ifndef DIRLIGHTMAP_OFF + float3 worldBinormal = cross(o.worldNormal, o.worldTangent.xyz); + o.viewDir.x = dot(viewDirForLight, o.worldTangent.xyz); + o.viewDir.y = dot(viewDirForLight, worldBinormal); + o.viewDir.z = dot(viewDirForLight, o.worldNormal); + #endif + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #else + o.lmap.zw = 0; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #ifdef DIRLIGHTMAP_OFF + o.lmapFadePos.xyz = (mul(GetObjectToWorldMatrix(), v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + #endif + #else + o.lmap.xy = 0; + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif + + return o; + } + + + + #ifdef LIGHTMAP_ON + float4 unity_LightmapFade; + #endif + fixed4 unity_Ambient; + + + + // fragment shader + void Frag (VertexToPixel IN, + out half4 outGBuffer0 : SV_Target0, + out half4 outGBuffer1 : SV_Target1, + out half4 outGBuffer2 : SV_Target2, + out half4 outEmission : SV_Target3 + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + , out half4 outShadowMask : SV_Target4 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + half atten = 1; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = 0; + gi.light.dir = half3(0,1,0); + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if _BDRF3 || _SIMPLELIT + + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + + outEmission = LightingBlinnPhong_Deferred(o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandardSpecular_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandard_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #endif + + #if defined(_OVERRIDE_SHADOWMASK) && defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + outShadowMask = mulColor; + #endif + + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #else + half4 outShadowMask = 0; + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #endif + + + } + + + + + ENDCG + + } + + + + + // ---- forward rendering additive lights pass: + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardAdd" } + ZWrite Off Blend One One + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma skip_variants INSTANCING_ON + #pragma multi_compile_fwdadd_fullshadows + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + + + #define _PASSFORWARD 1 + #define _PASSFORWARDADD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + UNITY_LIGHTING_COORDS(8,9) + UNITY_FOG_COORDS(10) + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD18; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + half4 c = 0; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + gi.light.color *= atten; + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + #endif + + #if _USESPECULAR + c += LightingStandardSpecular (o, worldViewDir, gi); + #elif _BDRF3 || _SIMPLELIT + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #else + c += LightingStandard (o, worldViewDir, gi); + #endif + + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + #if !_ALPHABLEND_ON + UNITY_OPAQUE_ALPHA(c.a); + #endif + + return c; + } + + ENDCG + + } + + + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + ZWrite On ZTest LEqual + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_shadowcaster + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + V2F_SHADOW_CASTER; // may declare TEXCOORD0 for the wonderfully named .vec + float3 worldPos : TEXCOORD1; + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 texcoord0 : TEXCOORD4; + float4 texcoord1 : TEXCOORD5; + float4 texcoord2 : TEXCOORD6; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD7; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD8; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD16; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + // sets o.pos, so do screenpos after. + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(IN.worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + SHADOW_CASTER_FRAGMENT(IN) + } + + + ENDCG + + } + + + // ---- meta information extraction pass: + Pass + { + Name "Meta" + Tags { "LightMode" = "Meta" } + Cull Off + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "UnityMetaPass.cginc" + + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifdef EDITOR_VISUALIZATION + float2 vizUV : TEXCOORD8; + float4 lightCoord : TEXCOORD9; + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD17; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + + o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #ifdef EDITOR_VISUALIZATION + o.vizUV = 0; + o.lightCoord = 0; + if (unity_VisualizationMode == EDITORVIZ_TEXTURE) + o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST); + else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) + { + o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(GetObjectToWorldMatrix(), float4(v.vertex.xyz, 1))); + } + #endif + + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + + ChainSurfaceFunction(l, d); + + UnityMetaInput metaIN; + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN); + metaIN.Albedo = l.Albedo; + metaIN.Emission = l.Emission; + + #if _USESPECULAR + metaIN.SpecularColor = l.Specular; + #endif + + #ifdef EDITOR_VISUALIZATION + metaIN.VizUV = IN.vizUV; + metaIN.LightCoord = IN.lightCoord; + #endif + return UnityMetaFragment(metaIN); + } + ENDCG + + } + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader.meta new file mode 100644 index 000000000..bd5d13165 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 86ce7e600deb17e429b8be445bb652f7 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader new file mode 100644 index 000000000..799e14988 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader @@ -0,0 +1,17705 @@ +// Upgrade NOTE: replaced 'defined FOG_COMBINED_WITH_WORLD_POS' with 'defined (FOG_COMBINED_WITH_WORLD_POS)' + +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: Standard +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + } + SubShader + { + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + // compile directives + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma multi_compile_fwdbase + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + // -------- variant for: + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + #define SHADER_PASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + float4 lmap : TEXCOORD8; + #if UNITY_SHOULD_SAMPLE_SH + half3 sh : TEXCOORD9; // SH + #endif + #ifdef LIGHTMAP_ON + UNITY_LIGHTING_COORDS(10,11) + UNITY_FOG_COORDS(12) + #else + UNITY_FOG_COORDS(10) + UNITY_SHADOW_COORDS(11) + #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + // SH/ambient and vertex lights + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + // Approximated illumination from non-important point lights + #ifdef VERTEXLIGHT_ON + o.sh += 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, o.worldPos, o.worldNormal); + #endif + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif // !LIGHTMAP_ON + + UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader + #else + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + // compute lighting & shadowing factor + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.Specular; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + fixed4 c = 0; + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + giInput.light.color *= mulColor; + #endif + + #if _UNLIT + c.rgb = l.Albedo; + c.a = l.Alpha; + #elif _BDRF3 || _SIMPLELIT + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandardSpecular (o, d.worldSpaceViewDir, gi); + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandard (o, d.worldSpaceViewDir, gi); + #endif + + c.rgb += o.Emission; + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + + + return c; + } + + ENDCG + + } + + + + // ---- deferred shading pass: + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma exclude_renderers nomrt + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_prepassfinal + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifndef DIRLIGHTMAP_OFF + float3 viewDir : TEXCOORD8; + #endif + float4 lmap : TEXCOORD9; + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + half3 sh : TEXCOORD10; // SH + #endif + #else + #ifdef DIRLIGHTMAP_OFF + float4 lmapFadePos : TEXCOORD11; + #endif + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + float3 viewDirForLight = UnityWorldSpaceViewDir(o.worldPos); + #ifndef DIRLIGHTMAP_OFF + float3 worldBinormal = cross(o.worldNormal, o.worldTangent.xyz); + o.viewDir.x = dot(viewDirForLight, o.worldTangent.xyz); + o.viewDir.y = dot(viewDirForLight, worldBinormal); + o.viewDir.z = dot(viewDirForLight, o.worldNormal); + #endif + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #else + o.lmap.zw = 0; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #ifdef DIRLIGHTMAP_OFF + o.lmapFadePos.xyz = (mul(GetObjectToWorldMatrix(), v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + #endif + #else + o.lmap.xy = 0; + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif + + return o; + } + + + + #ifdef LIGHTMAP_ON + float4 unity_LightmapFade; + #endif + fixed4 unity_Ambient; + + + + // fragment shader + void Frag (VertexToPixel IN, + out half4 outGBuffer0 : SV_Target0, + out half4 outGBuffer1 : SV_Target1, + out half4 outGBuffer2 : SV_Target2, + out half4 outEmission : SV_Target3 + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + , out half4 outShadowMask : SV_Target4 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + half atten = 1; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = 0; + gi.light.dir = half3(0,1,0); + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if _BDRF3 || _SIMPLELIT + + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + + outEmission = LightingBlinnPhong_Deferred(o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandardSpecular_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandard_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #endif + + #if defined(_OVERRIDE_SHADOWMASK) && defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + outShadowMask = mulColor; + #endif + + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #else + half4 outShadowMask = 0; + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #endif + + + } + + + + + ENDCG + + } + + + + + // ---- forward rendering additive lights pass: + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardAdd" } + ZWrite Off Blend One One + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma skip_variants INSTANCING_ON + #pragma multi_compile_fwdadd_fullshadows + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + + + #define _PASSFORWARD 1 + #define _PASSFORWARDADD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + UNITY_LIGHTING_COORDS(8,9) + UNITY_FOG_COORDS(10) + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD18; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + half4 c = 0; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + gi.light.color *= atten; + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + #endif + + #if _USESPECULAR + c += LightingStandardSpecular (o, worldViewDir, gi); + #elif _BDRF3 || _SIMPLELIT + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #else + c += LightingStandard (o, worldViewDir, gi); + #endif + + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + #if !_ALPHABLEND_ON + UNITY_OPAQUE_ALPHA(c.a); + #endif + + return c; + } + + ENDCG + + } + + + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + ZWrite On ZTest LEqual + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_shadowcaster + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + V2F_SHADOW_CASTER; // may declare TEXCOORD0 for the wonderfully named .vec + float3 worldPos : TEXCOORD1; + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 texcoord0 : TEXCOORD4; + float4 texcoord1 : TEXCOORD5; + float4 texcoord2 : TEXCOORD6; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD7; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD8; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD16; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + // sets o.pos, so do screenpos after. + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(IN.worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + SHADOW_CASTER_FRAGMENT(IN) + } + + + ENDCG + + } + + + // ---- meta information extraction pass: + Pass + { + Name "Meta" + Tags { "LightMode" = "Meta" } + Cull Off + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "UnityMetaPass.cginc" + + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifdef EDITOR_VISUALIZATION + float2 vizUV : TEXCOORD8; + float4 lightCoord : TEXCOORD9; + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD17; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + + o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #ifdef EDITOR_VISUALIZATION + o.vizUV = 0; + o.lightCoord = 0; + if (unity_VisualizationMode == EDITORVIZ_TEXTURE) + o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST); + else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) + { + o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(GetObjectToWorldMatrix(), float4(v.vertex.xyz, 1))); + } + #endif + + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined (FOG_COMBINED_WITH_WORLD_POS) + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + + ChainSurfaceFunction(l, d); + + UnityMetaInput metaIN; + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN); + metaIN.Albedo = l.Albedo; + metaIN.Emission = l.Emission; + + #if _USESPECULAR + metaIN.SpecularColor = l.Specular; + #endif + + #ifdef EDITOR_VISUALIZATION + metaIN.VizUV = IN.vizUV; + metaIN.LightCoord = IN.lightCoord; + #endif + return UnityMetaFragment(metaIN); + } + ENDCG + + } + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader.meta new file mode 100644 index 000000000..e0fca50fd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 4cab4aa8ce3e6774aa0d904ec70df88e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader new file mode 100644 index 000000000..c7ab18a1c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader @@ -0,0 +1,1236 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShaderScaledTime" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + Tags { "Queue" = "Transparent" "CanUseSpriteAtlas" = "True" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_instancing + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHAROUND_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature ATLAS_ON + #pragma shader_feature PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + #pragma shader_feature FOG_ON + + #include "UnityCG.cginc" + #include "AllIn1OneShaderFunctions.cginc" + + #if FOG_ON + #pragma multi_compile_fog + #endif + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD3; + #endif + #if FOG_ON + UNITY_FOG_COORDS(4) + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + float globalUnscaledTime; + + sampler2D _MainTex; + half4 _MainTex_ST, _MainTex_TexelSize, _Color; + half _Alpha; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if FADE_ON + sampler2D _FadeTex, _FadeBurnTex; + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if GLOW_ON + sampler2D _GlowTex; + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + sampler2D _OutlineTex; + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + sampler2D _OutlineDistortTex; + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if DISTORT_ON + sampler2D _DistortTex; + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + sampler2D _ColorSwapTex; + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if COLORRAMP_ON + sampler2D _ColorRampTex, _ColorRampTexGradient; + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + sampler2D _ShineMask; + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if ALPHACUTOFF_ON + half _AlphaCutoffValue; + #endif + + #if ALPHAROUND_ON + half _AlphaRoundThreshold; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + sampler2D _OverlayTex; + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + UNITY_INSTANCING_BUFFER_START(Props) + UNITY_DEFINE_INSTANCED_PROP(float, _RandomSeed) + UNITY_INSTANCING_BUFFER_END(Props) + + v2f vert (appdata v) + { + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + o.vertex = UnityObjectToClipPos(half4(localPos, 1)); + #else + o.vertex = UnityObjectToClipPos(v.vertex); + #endif + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = TRANSFORM_TEX(v.uv, _OutlineTex); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = TRANSFORM_TEX(v.uv, _OutlineDistortTex); + #endif + + #if DISTORT_ON + o.uvDistTex = TRANSFORM_TEX(v.uv, _DistortTex); + #endif + + #if FOG_ON + UNITY_TRANSFER_FOG(o,o.vertex); + #endif + + return o; + } + + half3 GetPixel(in int offsetX, in int offsetY, half2 uv, sampler2D tex) + { + return tex2D(tex, (uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y))).rgb; + } + + half4 frag (v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((((globalUnscaledTime * 20) + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs((((globalUnscaledTime * 20) + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ST.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor(((globalUnscaledTime * 20) + randomSeed) * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((globalUnscaledTime + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((globalUnscaledTime + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((globalUnscaledTime + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((globalUnscaledTime + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (tex2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = ((globalUnscaledTime * 20) + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = ((globalUnscaledTime * 20) + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = (globalUnscaledTime * 20) + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + ((globalUnscaledTime * 20) + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if WIND_ON + half windOffset = sin((globalUnscaledTime + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += (((globalUnscaledTime * 20) + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += (((globalUnscaledTime * 20) + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = tex2D(_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2CustomTime(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, globalUnscaledTime), 3.0) * _GlitchAmount + * pow(rand2CustomTime(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, globalUnscaledTime), 3.0); + col = tex2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2CustomTime(half2(2.0, 1), randomSeed, globalUnscaledTime), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = tex2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = tex2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = tex2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = col.rgb; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = i.uv; + overlayUvs.x += (((globalUnscaledTime * 20) + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += (((globalUnscaledTime * 20) + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = tex2D(_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + i.uvOutDistTex.x += ((globalUnscaledTime + randomSeed) * _OutlineDistortTexXSpeed) % 1; + i.uvOutDistTex.y += ((globalUnscaledTime + randomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutDistTex = half2((i.uvOutDistTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutDistTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (tex2D(_OutlineDistortTex, i.uvOutDistTex).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = tex2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = tex2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = tex2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = tex2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = tex2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = tex2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = tex2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = tex2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((globalUnscaledTime + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((globalUnscaledTime + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = tex2D(_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= TRANSFORM_TEX(i.uv, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(i.uv, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = tex2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * tex2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = tex2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = tex2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = tex2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((globalUnscaledTime + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + ((globalUnscaledTime * 60) + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + + #if FOG_ON + UNITY_APPLY_FOG(i.fogCoord, col); + #endif + + return col; + } + ENDCG + } + } + CustomEditor "AllIn1SpriteShaderMaterialInspector" + //Fallback "Sprites/Default" //Remove fallback so that any shader error is obvious to the user +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader.meta new file mode 100644 index 000000000..8186b09c7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: f3622b3ac1631ea409b0f5811034f3a9 +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _GlowTex: {instanceID: 0} + - _FadeTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _FadeBurnTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + - _OutlineTex: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + - _OutlineDistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, + type: 3} + - _ColorSwapTex: {instanceID: 0} + - _ColorRampTex: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + - _DistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ShineMask: {instanceID: 0} + - _ColorRampTexGradient: {instanceID: 0} + - _OverlayTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader new file mode 100644 index 000000000..f9256b228 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader @@ -0,0 +1,1247 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShaderUiMask" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _Stencil ("Stencil ID", Float) = 0 + _StencilComp ("Stencil Comparison", Float) = 8 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + _ColorMask ("Color Mask", Float) = 15 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" } + Blend [_MySrcMode] [_MyDstMode] + Cull Off + ZWrite Off + ZTest [unity_GUIZTestMode] + ColorMask [_ColorMask] + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_instancing + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHAROUND_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature ATLAS_ON + #pragma shader_feature PREMULTIPLYALPHA_ON + + #pragma multi_compile _ UNITY_UI_CLIP_RECT + #pragma multi_compile _ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "AllIn1OneShaderFunctions.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD3; + #endif + #if UNITY_UI_CLIP_RECT + half4 mask : TEXCOORD4; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if UNITY_UI_CLIP_RECT + float4 _ClipRect; + half _UIMaskSoftnessX, _UIMaskSoftnessY; + #endif + + sampler2D _MainTex; + half4 _MainTex_ST, _MainTex_TexelSize, _Color; + half _Alpha; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if FADE_ON + sampler2D _FadeTex, _FadeBurnTex; + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if GLOW_ON + sampler2D _GlowTex; + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + sampler2D _OutlineTex; + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + sampler2D _OutlineDistortTex; + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if DISTORT_ON + sampler2D _DistortTex; + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + sampler2D _ColorSwapTex; + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if COLORRAMP_ON + sampler2D _ColorRampTex, _ColorRampTexGradient; + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + sampler2D _ShineMask; + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if ALPHACUTOFF_ON + half _AlphaCutoffValue; + #endif + + #if ALPHAROUND_ON + half _AlphaRoundThreshold; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + sampler2D _OverlayTex; + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + UNITY_INSTANCING_BUFFER_START(Props) + UNITY_DEFINE_INSTANCED_PROP(float, _RandomSeed) + UNITY_INSTANCING_BUFFER_END(Props) + + v2f vert(appdata v) + { + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + + #if UNITY_UI_CLIP_RECT + half2 pixelSize = o.vertex.w; + pixelSize /= half2(1, 1) * abs(mul((half2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + half4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + half2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + o.mask = half4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy))); + #endif + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = TRANSFORM_TEX(v.uv, _OutlineTex); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = TRANSFORM_TEX(v.uv, _OutlineDistortTex); + #endif + + #if DISTORT_ON + o.uvDistTex = TRANSFORM_TEX(v.uv, _DistortTex); + #endif + + return o; + } + + half3 GetPixel(in int offsetX, in int offsetY, half2 uv, sampler2D tex) + { + return tex2D(tex, (uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y))).rgb; + } + + half4 frag(v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ST.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((_Time.x + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((_Time.x + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (tex2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = tex2D(_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = tex2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = tex2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = tex2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = tex2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = i.uv; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = tex2D(_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + i.uvOutDistTex.x += ((_Time.x + randomSeed) * _OutlineDistortTexXSpeed) % 1; + i.uvOutDistTex.y += ((_Time.x + randomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutDistTex = half2((i.uvOutDistTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutDistTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (tex2D(_OutlineDistortTex, i.uvOutDistTex).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = tex2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = tex2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = tex2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = tex2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = tex2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = tex2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = tex2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = tex2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((_Time.x + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((_Time.x + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = tex2D(_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= TRANSFORM_TEX(i.uv, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(i.uv, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = tex2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * tex2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = tex2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = tex2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = tex2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if UNITY_UI_CLIP_RECT + half2 clipMask = saturate((_ClipRect.zw - _ClipRect.xy - abs(i.mask.xy)) * i.mask.zw); + col.a *= clipMask.x * clipMask.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip (col.a - 0.001); + #endif + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + + return col; + } + ENDCG + } + } + CustomEditor "AllIn1SpriteShaderUiMaskMaterialInspector" + //Fallback "Sprites/Default" //Remove fallback so that any shader error is obvious to the user +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader.meta new file mode 100644 index 000000000..8b60c764f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: a53f4bb29f3644b43b5075c6dcfecb32 +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _GlowTex: {instanceID: 0} + - _FadeTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _FadeBurnTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + - _OutlineTex: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + - _OutlineDistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, + type: 3} + - _ColorSwapTex: {instanceID: 0} + - _ColorRampTex: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + - _DistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ShineMask: {instanceID: 0} + - _ColorRampTexGradient: {instanceID: 0} + - _OverlayTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader new file mode 100644 index 000000000..45cab0a8d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader @@ -0,0 +1,1249 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShaderUiMaskScaledTime" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _Stencil ("Stencil ID", Float) = 0 + _StencilComp ("Stencil Comparison", Float) = 8 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + _ColorMask ("Color Mask", Float) = 15 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" } + Blend [_MySrcMode] [_MyDstMode] + Cull Off + ZWrite Off + ZTest [unity_GUIZTestMode] + ColorMask [_ColorMask] + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_instancing + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHAROUND_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature ATLAS_ON + #pragma shader_feature PREMULTIPLYALPHA_ON + + #pragma multi_compile _ UNITY_UI_CLIP_RECT + #pragma multi_compile _ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "AllIn1OneShaderFunctions.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD3; + #endif + #if UNITY_UI_CLIP_RECT + half4 mask : TEXCOORD4; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if UNITY_UI_CLIP_RECT + float4 _ClipRect; + half _UIMaskSoftnessX, _UIMaskSoftnessY; + #endif + + float globalUnscaledTime; + + sampler2D _MainTex; + half4 _MainTex_ST, _MainTex_TexelSize, _Color; + half _Alpha; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if FADE_ON + sampler2D _FadeTex, _FadeBurnTex; + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if GLOW_ON + sampler2D _GlowTex; + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + sampler2D _OutlineTex; + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + sampler2D _OutlineDistortTex; + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if DISTORT_ON + sampler2D _DistortTex; + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + sampler2D _ColorSwapTex; + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if COLORRAMP_ON + sampler2D _ColorRampTex, _ColorRampTexGradient; + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + sampler2D _ShineMask; + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if ALPHACUTOFF_ON + half _AlphaCutoffValue; + #endif + + #if ALPHAROUND_ON + half _AlphaRoundThreshold; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + sampler2D _OverlayTex; + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + UNITY_INSTANCING_BUFFER_START(Props) + UNITY_DEFINE_INSTANCED_PROP(float, _RandomSeed) + UNITY_INSTANCING_BUFFER_END(Props) + + v2f vert(appdata v) + { + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + + #if UNITY_UI_CLIP_RECT + half2 pixelSize = o.vertex.w; + pixelSize /= half2(1, 1) * abs(mul((half2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + half4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + half2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + o.mask = half4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy))); + #endif + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = TRANSFORM_TEX(v.uv, _OutlineTex); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = TRANSFORM_TEX(v.uv, _OutlineDistortTex); + #endif + + #if DISTORT_ON + o.uvDistTex = TRANSFORM_TEX(v.uv, _DistortTex); + #endif + + return o; + } + + half3 GetPixel(in int offsetX, in int offsetY, half2 uv, sampler2D tex) + { + return tex2D(tex, (uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y))).rgb; + } + + half4 frag(v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((((globalUnscaledTime * 20) + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs((((globalUnscaledTime * 20) + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ST.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((globalUnscaledTime + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((globalUnscaledTime + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((globalUnscaledTime + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((globalUnscaledTime + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((globalUnscaledTime + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (tex2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = ((globalUnscaledTime * 20) + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = ((globalUnscaledTime * 20) + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = (globalUnscaledTime * 20) + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + ((globalUnscaledTime * 20) + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if WIND_ON + half windOffset = sin((globalUnscaledTime + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += (((globalUnscaledTime * 20) + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += (((globalUnscaledTime * 20) + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = tex2D(_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2CustomTime(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, globalUnscaledTime), 3.0) * _GlitchAmount + * pow(rand2CustomTime(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, globalUnscaledTime), 3.0); + col = tex2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2CustomTime(half2(2.0, 1), randomSeed, globalUnscaledTime), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = tex2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = tex2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = tex2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = i.uv; + overlayUvs.x += (((globalUnscaledTime * 20) + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += (((globalUnscaledTime * 20) + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = tex2D(_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + i.uvOutDistTex.x += ((globalUnscaledTime + randomSeed) * _OutlineDistortTexXSpeed) % 1; + i.uvOutDistTex.y += ((globalUnscaledTime + randomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutDistTex = half2((i.uvOutDistTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutDistTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (tex2D(_OutlineDistortTex, i.uvOutDistTex).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = tex2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = tex2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = tex2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = tex2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = tex2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = tex2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = tex2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = tex2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((globalUnscaledTime + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((globalUnscaledTime + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = tex2D(_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= TRANSFORM_TEX(i.uv, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(i.uv, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = tex2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * tex2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = tex2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = tex2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = tex2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((globalUnscaledTime + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + ((globalUnscaledTime * 60) + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if UNITY_UI_CLIP_RECT + half2 clipMask = saturate((_ClipRect.zw - _ClipRect.xy - abs(i.mask.xy)) * i.mask.zw); + col.a *= clipMask.x * clipMask.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip (col.a - 0.001); + #endif + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + + return col; + } + ENDCG + } + } + CustomEditor "AllIn1SpriteShaderUiMaskMaterialInspector" + //Fallback "Sprites/Default" //Remove fallback so that any shader error is obvious to the user +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader.meta new file mode 100644 index 000000000..ba9eb5ddf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: e89361f7792fee34fbaa655df899c819 +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _GlowTex: {instanceID: 0} + - _FadeTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _FadeBurnTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + - _OutlineTex: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + - _OutlineDistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, + type: 3} + - _ColorSwapTex: {instanceID: 0} + - _ColorRampTex: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + - _DistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ShineMask: {instanceID: 0} + - _ColorRampTexGradient: {instanceID: 0} + - _OverlayTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders.meta new file mode 100644 index 000000000..153166a7f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ab83761dc46d94e4e90385302b0cd179 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader new file mode 100644 index 000000000..532d3362a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader @@ -0,0 +1,1437 @@ +BEGIN_OPTIONS + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" + ShaderName "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +END_OPTIONS + +BEGIN_SUBSHADER + +END_SUBSHADER + +BEGIN_PROPERTIES + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 +END_PROPERTIES + + +BEGIN_DEFINES + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON +END_DEFINES + +BEGIN_CBUFFER + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + +END_CBUFFER + +BEGIN_PASS("All") + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha +END_PASS + +BEGIN_CODE + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void ModifyVertex(inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void SurfaceFunction(inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + +END_CODE \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader.meta new file mode 100644 index 000000000..b5402a825 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader.meta @@ -0,0 +1,17 @@ +fileFormatVersion: 2 +guid: 906fe447de9ad3b4e8d21d6ba60deb8a +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: ed1b96e11e9064957833ce8c01da6f92, type: 3} +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt new file mode 100644 index 000000000..06066d20a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt @@ -0,0 +1,16853 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2019 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector] _StencilRef("Vector1 ", Int) = 0 + [HideInInspector] _StencilWriteMask("Vector1 ", Int) = 3 + [HideInInspector] _StencilRefDepth("Vector1 ", Int) = 0 + [HideInInspector] _StencilWriteMaskDepth("Vector1 ", Int) = 32 + [HideInInspector] _StencilRefMV("Vector1 ", Int) = 128 + [HideInInspector] _StencilWriteMaskMV("Vector1 ", Int) = 128 + [HideInInspector] _StencilRefDistortionVec("Vector1 ", Int) = 64 + [HideInInspector] _StencilWriteMaskDistortionVec("Vector1 ", Int) = 64 + [HideInInspector] _StencilWriteMaskGBuffer("Vector1 ", Int) = 3 + [HideInInspector] _StencilRefGBuffer("Vector1 ", Int) = 2 + [HideInInspector] _ZTestGBuffer("Vector1 ", Int) = 4 + [HideInInspector] [ToggleUI] _RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _ReceivesSSR("Boolean", Float) = 1 + [HideInInspector] _SurfaceType("Vector1 ", Float) = 0 + [HideInInspector] [ToggleUI] _ZWrite("Boolean", Float) = 0 + [HideInInspector] _TransparentSortPriority("Vector1 ", Int) = 0 + [HideInInspector] _ZTestDepthEqualForOpaque("Vector1 ", Int) = 4 + [HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("Vector1", Float) = 4 + [HideInInspector] [ToggleUI] _TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector] _BlendMode("Float", Float) = 0 + } + SubShader + { + Tags { "RenderPipeline"="HDRenderPipeline" "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + Comp Always + Pass Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + // #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADDITIVE _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #define REQUIRE_DEPTH_TEXTURE + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + void Frag(PackedVaryingsToPS packedInput, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + out float4 outDiffuseLighting : SV_Target1, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : SV_Target1 + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = int(_DebugViewMaterialArray[0]); + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = int(_DebugViewMaterialArray[index]); + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + float3 diffuseLighting; + float3 specularLighting; + + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + { + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + // Alias + diffuseLighting = lightLoopOutput.diffuseLighting; + specularLighting = lightLoopOutput.specularLighting; + } + #else + { + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, diffuseLighting, specularLighting); + } + #endif + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + VaryingsPassToPS inputPass = UnpackVaryingsPassToPS(packedInput.vpass); + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(inputPass.positionCS, inputPass.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + ZTest [_ZTestGBuffer] + + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + Comp Always + Pass Replace + } + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + #define SHADERPASS SHADERPASS_GBUFFER + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile _ LIGHT_LAYERS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + void Frag( PackedVaryingsToPS packedInput, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + ZClip [_ZClip] + ZWrite On + ZTest LEqual + + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + float4 Frag(PackedVaryingsToPS packedInput + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) : SV_Target + { + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENESELECTIONPASS + #pragma editor_sync_compilation + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + // #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt.meta new file mode 100644 index 000000000..df057e2a9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 399eb10a7a397d147aedd61cb363c5b0 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt new file mode 100644 index 000000000..3ba2ceecf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt @@ -0,0 +1,25674 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2020 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt.meta new file mode 100644 index 000000000..c5625a0be --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a647821724afdce49a1ba80aff36898d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt new file mode 100644 index 000000000..572d2ea33 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt @@ -0,0 +1,25529 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2021 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH SHADOW_VERY_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ LIGHT_LAYERS + #pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt.meta new file mode 100644 index 000000000..b3f2db6c8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a5e970f81e60df04c8f073f570232b06 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt new file mode 100644 index 000000000..ea350a73a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt @@ -0,0 +1,26358 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2022 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + ColorMask [_LightLayersMaskBuffer4] 4 + ColorMask [_LightLayersMaskBuffer5] 5 + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_LightLayersMaskBuffer4] 4 + ColorMask [_LightLayersMaskBuffer5] 5 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma target 4.5 + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile _ LIGHT_LAYERS + //#pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + AlphaToMask [_AlphaCutoffEnable] + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : DEPTH_OFFSET_SEMANTIC + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = unity_SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt.meta new file mode 100644 index 000000000..4ab1b9d69 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 9e1b3d9455d4c4b41ae7fe2ce00204de +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt new file mode 100644 index 000000000..75d2b5a8d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt @@ -0,0 +1,26409 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma target 4.5 + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ RENDERING_LAYERS + //#pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + AlphaToMask [_AlphaCutoffEnable] + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : DEPTH_OFFSET_SEMANTIC + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = unity_SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLayerMask() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt.meta new file mode 100644 index 000000000..cec946b56 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: c397c4395866b3f43a53dfd559528372 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt new file mode 100644 index 000000000..288d9510e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt @@ -0,0 +1,17703 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: Standard +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + } + SubShader + { + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + // compile directives + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma multi_compile_fwdbase + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + // -------- variant for: + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + #define SHADER_PASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + float4 lmap : TEXCOORD8; + #if UNITY_SHOULD_SAMPLE_SH + half3 sh : TEXCOORD9; // SH + #endif + #ifdef LIGHTMAP_ON + UNITY_LIGHTING_COORDS(10,11) + UNITY_FOG_COORDS(12) + #else + UNITY_FOG_COORDS(10) + UNITY_SHADOW_COORDS(11) + #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + // SH/ambient and vertex lights + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + // Approximated illumination from non-important point lights + #ifdef VERTEXLIGHT_ON + o.sh += 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, o.worldPos, o.worldNormal); + #endif + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif // !LIGHTMAP_ON + + UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader + #else + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + // compute lighting & shadowing factor + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.Specular; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + fixed4 c = 0; + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + giInput.light.color *= mulColor; + #endif + + #if _UNLIT + c.rgb = l.Albedo; + c.a = l.Alpha; + #elif _BDRF3 || _SIMPLELIT + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandardSpecular (o, d.worldSpaceViewDir, gi); + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandard (o, d.worldSpaceViewDir, gi); + #endif + + c.rgb += o.Emission; + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + + + return c; + } + + ENDCG + + } + + + + // ---- deferred shading pass: + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma exclude_renderers nomrt + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_prepassfinal + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifndef DIRLIGHTMAP_OFF + float3 viewDir : TEXCOORD8; + #endif + float4 lmap : TEXCOORD9; + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + half3 sh : TEXCOORD10; // SH + #endif + #else + #ifdef DIRLIGHTMAP_OFF + float4 lmapFadePos : TEXCOORD11; + #endif + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + float3 viewDirForLight = UnityWorldSpaceViewDir(o.worldPos); + #ifndef DIRLIGHTMAP_OFF + float3 worldBinormal = cross(o.worldNormal, o.worldTangent.xyz); + o.viewDir.x = dot(viewDirForLight, o.worldTangent.xyz); + o.viewDir.y = dot(viewDirForLight, worldBinormal); + o.viewDir.z = dot(viewDirForLight, o.worldNormal); + #endif + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #else + o.lmap.zw = 0; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #ifdef DIRLIGHTMAP_OFF + o.lmapFadePos.xyz = (mul(GetObjectToWorldMatrix(), v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + #endif + #else + o.lmap.xy = 0; + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif + + return o; + } + + + + #ifdef LIGHTMAP_ON + float4 unity_LightmapFade; + #endif + fixed4 unity_Ambient; + + + + // fragment shader + void Frag (VertexToPixel IN, + out half4 outGBuffer0 : SV_Target0, + out half4 outGBuffer1 : SV_Target1, + out half4 outGBuffer2 : SV_Target2, + out half4 outEmission : SV_Target3 + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + , out half4 outShadowMask : SV_Target4 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + half atten = 1; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = 0; + gi.light.dir = half3(0,1,0); + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if _BDRF3 || _SIMPLELIT + + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + + outEmission = LightingBlinnPhong_Deferred(o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandardSpecular_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandard_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #endif + + #if defined(_OVERRIDE_SHADOWMASK) && defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + outShadowMask = mulColor; + #endif + + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #else + half4 outShadowMask = 0; + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #endif + + + } + + + + + ENDCG + + } + + + + + // ---- forward rendering additive lights pass: + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardAdd" } + ZWrite Off Blend One One + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma skip_variants INSTANCING_ON + #pragma multi_compile_fwdadd_fullshadows + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + + + #define _PASSFORWARD 1 + #define _PASSFORWARDADD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + UNITY_LIGHTING_COORDS(8,9) + UNITY_FOG_COORDS(10) + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD18; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + half4 c = 0; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + gi.light.color *= atten; + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + #endif + + #if _USESPECULAR + c += LightingStandardSpecular (o, worldViewDir, gi); + #elif _BDRF3 || _SIMPLELIT + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #else + c += LightingStandard (o, worldViewDir, gi); + #endif + + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + #if !_ALPHABLEND_ON + UNITY_OPAQUE_ALPHA(c.a); + #endif + + return c; + } + + ENDCG + + } + + + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + ZWrite On ZTest LEqual + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_shadowcaster + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + V2F_SHADOW_CASTER; // may declare TEXCOORD0 for the wonderfully named .vec + float3 worldPos : TEXCOORD1; + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 texcoord0 : TEXCOORD4; + float4 texcoord1 : TEXCOORD5; + float4 texcoord2 : TEXCOORD6; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD7; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD8; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD16; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + // sets o.pos, so do screenpos after. + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(IN.worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + SHADOW_CASTER_FRAGMENT(IN) + } + + + ENDCG + + } + + + // ---- meta information extraction pass: + Pass + { + Name "Meta" + Tags { "LightMode" = "Meta" } + Cull Off + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "UnityMetaPass.cginc" + + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifdef EDITOR_VISUALIZATION + float2 vizUV : TEXCOORD8; + float4 lightCoord : TEXCOORD9; + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD17; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + + o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #ifdef EDITOR_VISUALIZATION + o.vizUV = 0; + o.lightCoord = 0; + if (unity_VisualizationMode == EDITORVIZ_TEXTURE) + o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST); + else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) + { + o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(GetObjectToWorldMatrix(), float4(v.vertex.xyz, 1))); + } + #endif + + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + + ChainSurfaceFunction(l, d); + + UnityMetaInput metaIN; + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN); + metaIN.Albedo = l.Albedo; + metaIN.Emission = l.Emission; + + #if _USESPECULAR + metaIN.SpecularColor = l.Specular; + #endif + + #ifdef EDITOR_VISUALIZATION + metaIN.VizUV = IN.vizUV; + metaIN.LightCoord = IN.lightCoord; + #endif + return UnityMetaFragment(metaIN); + } + ENDCG + + } + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt.meta new file mode 100644 index 000000000..dc6b6ddcb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 3d8afde0e2ea785468f09f3f58cf5803 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt new file mode 100644 index 000000000..2972ba3ba --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt @@ -0,0 +1,11791 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2019 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + + // Keywords + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF + #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile _ _SHADOWS_SOFT + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + + // GraphKeywords: + + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADER_PASS SHADERPASS_FORWARD + #define SHADERPASS_FORWARD + + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_USESPECULAR) || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + InputData inputData; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + + #if !_UNLIT + #if _SIMPLELIT + half4 color = UniversalFragmentBlinnPhong( + inputData, + l.Albedo, + float4(specular * l.Smoothness, 0), + l.SpecularPower * 128, + l.Emission, + l.Alpha); + color.a = l.Alpha; + #elif _BAKEDLIT + half4 color = color = UniversalFragmentBakedLit(inputData, l.Albedo, l.Alpha, normalTS); + #else + half4 color = UniversalFragmentPBR( + inputData, + l.Albedo, + metallic, + specular, + l.Smoothness, + l.Occlusion, + l.Emission, + l.Alpha); + #endif + + #else + half4 color = half4(l.Albedo, l.Alpha); + #endif + + #if _UNLITFOG && !DISABLEFOG + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_SHADOWCASTER + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_DEPTHONLY + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #define _PASSDEPTH 1 + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + // Render State + Cull Off + // ColorMask: + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + // Name: + Tags + { + "LightMode" = "Universal2D" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define SHADERPASS_2D + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + + half4 color = half4(l.Albedo, l.Alpha); + + return color; + + } + + ENDHLSL + + } + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt.meta new file mode 100644 index 000000000..694d68c4e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b6a5f34c034fbd04db605bdcc50b16cd +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt new file mode 100644 index 000000000..e12c895cb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt @@ -0,0 +1,11893 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2020 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF + #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #endif + + #if !_UNLIT + #if _SIMPLELIT + half4 color = UniversalFragmentBlinnPhong( + inputData, + l.Albedo, + float4(specular * l.Smoothness, 0), + l.SpecularPower * 128, + l.Emission, + l.Alpha); + color.a = l.Alpha; + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, l.Albedo, l.Alpha, normalTS); + #else + + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + half4 color = UniversalFragmentPBR(inputData, surface); + + #endif + + #else + half4 color = half4(l.Albedo, l.Alpha); + + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_SHADOWCASTER + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define SHADERPASS_DEPTHONLY + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + // Render State + Cull Off + // ColorMask: + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return float4(PackNormalOctRectEncode(TransformWorldToViewDir(d.worldSpaceNormal, true)), 0.0, 0.0); + + } + + ENDHLSL + + } + + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt.meta new file mode 100644 index 000000000..5825e7aa7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 5b690ab8311c671458478ca7f852b720 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt new file mode 100644 index 000000000..462f45b9c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt @@ -0,0 +1,14456 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2021 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _CLUSTERED_RENDERING + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "GBuffer" + Tags + { + "LightMode" = "UniversalGBuffer" + } + + Blend One Zero + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile _ SHADOWS_SHADOWMASK + + #define _FOG_FRAGMENT 1 + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADERPASS SHADERPASS_GBUFFER + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + // fragment shader + FragmentOutput Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 0; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + //inputData.fogCoord = IN.fogFactorAndVertexLight.x; + InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.pos, + l.Albedo, + specular, + inputData.normalWS, + metallic, + l.Occlusion, + l.Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData(l.Albedo, metallic, specular, l.Smoothness, l.Alpha, brdfData); + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, l.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + + return BRDFDataToGbuffer(brdfData, inputData, l.Smoothness, l.Emission + color, l.Occlusion); + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = d.worldSpaceNormal; + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on some platforms + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1] + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1] + return half4(packedNormalWS, 0.0); + #else + float3 wsn = l.Normal; + #if !_WORLDSPACENORMAL + wsn = TangentToWorldSpace(d, l.Normal); + #endif + return half4(NormalizeNormalPerPixel(wsn), 0.0); + #endif + + + } + + ENDHLSL + + } + + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt.meta new file mode 100644 index 000000000..0c9d03282 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: cf43ea038b1b8bc40bb9018effdc2e94 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt new file mode 100644 index 000000000..89ebc54d3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt @@ -0,0 +1,14505 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2022 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "GBuffer" + Tags + { + "LightMode" = "UniversalGBuffer" + } + + Blend One Zero + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + #define _FOG_FRAGMENT 1 + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADERPASS SHADERPASS_GBUFFER + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + // fragment shader + FragmentOutput Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 0; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + //inputData.fogCoord = IN.fogFactorAndVertexLight.x; + InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.pos, + l.Albedo, + specular, + inputData.normalWS, + metallic, + l.Occlusion, + l.Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData(l.Albedo, metallic, specular, l.Smoothness, l.Alpha, brdfData); + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, l.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + + return BRDFDataToGbuffer(brdfData, inputData, l.Smoothness, l.Emission + color, l.Occlusion); + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) && USE_UNITY_CROSSFADE + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outNormalWS : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = d.worldSpaceNormal; + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on some platforms + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1] + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1] + outNormalWS = half4(packedNormalWS, 0.0); + #else + float3 wsn = l.Normal; + #if !_WORLDSPACENORMAL + wsn = TangentToWorldSpace(d, l.Normal); + #endif + outNormalWS = half4(NormalizeNormalPerPixel(wsn), 0.0); + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + + } + + ENDHLSL + + } + + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt.meta new file mode 100644 index 000000000..0766a189d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: ce8330b40cde2f94c9cb20367e34bd3a +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt new file mode 100644 index 000000000..255760ba8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt @@ -0,0 +1,17685 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.01 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_VERTEX + #pragma multi_compile _ EVALUATE_SH_MIXED + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "GBuffer" + Tags + { + "LightMode" = "UniversalGBuffer" + } + + Blend One Zero + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + #define _FOG_FRAGMENT 1 + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADERPASS SHADERPASS_GBUFFER + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // Includes + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + // fragment shader + FragmentOutput Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 0; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + //inputData.fogCoord = IN.fogFactorAndVertexLight.x; + InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.pos, + l.Albedo, + specular, + inputData.normalWS, + metallic, + l.Occlusion, + l.Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData(l.Albedo, metallic, specular, l.Smoothness, l.Alpha, brdfData); + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, l.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + + return BRDFDataToGbuffer(brdfData, inputData, l.Smoothness, l.Emission + color, l.Occlusion); + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + // Includes + //#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) && USE_UNITY_CROSSFADE + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outNormalWS : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = d.worldSpaceNormal; + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on some platforms + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1] + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1] + outNormalWS = half4(packedNormalWS, 0.0); + #else + float3 wsn = l.Normal; + #if !_WORLDSPACENORMAL + wsn = TangentToWorldSpace(d, l.Normal); + #endif + outNormalWS = half4(NormalizeNormalPerPixel(wsn), 0.0); + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + + } + + ENDHLSL + + } + + + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + ColorMask RG + + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #define _PASSMOTIONVECTOR 1 + + #pragma target 3.5 + #pragma multi_compile_instancing + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // Using parts of com.unity.render-pipelines.universal\Editor\ShaderGraph\Includes\MotionVectorPass.hlsl + // com.unity.render-pipelines.universal\ShaderLibrary\MotionVectorsCommon.hlsl + // com.unity.render-pipelines.universal\Editor\ShaderGraph\Includes\Varyings.hlsl + + float2 CalcNdcMotionVectorFromCsPositions(float4 posCS, float4 prevPosCS) + { + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + return float2(0.0, 0.0); + + // Non-uniform raster needs to keep the posNDC values in float to avoid additional conversions + // since uv remap functions use floats + float2 posNDC = posCS.xy * rcp(posCS.w); + float2 prevPosNDC = prevPosCS.xy * rcp(prevPosCS.w); + + float2 velocity; + #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) + UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) + { + // Convert velocity from NDC space (-1..1) to screen UV 0..1 space since FoveatedRendering remap needs that range. + float2 posUV = RemapFoveatedRenderingResolve(posNDC * 0.5 + 0.5); + float2 prevPosUV = RemapFoveatedRenderingPrevFrameLinearToNonUniform(prevPosNDC * 0.5 + 0.5); + + // Calculate forward velocity + velocity = (posUV - prevPosUV); + #if UNITY_UV_STARTS_AT_TOP + velocity.y = -velocity.y; + #endif + } + else + #endif + { + // Calculate forward velocity + velocity = (posNDC.xy - prevPosNDC.xy); + #if UNITY_UV_STARTS_AT_TOP + velocity.y = -velocity.y; + #endif + + // Convert velocity from NDC space (-1..1) to UV 0..1 space + // Note: It doesn't mean we don't have negative values, we store negative or positive offset in UV space. + // Note: ((posNDC * 0.5 + 0.5) - (prevPosNDC * 0.5 + 0.5)) = (velocity * 0.5) + velocity.xy *= 0.5; + } + + return velocity; + } + + float4 Frag( + VertexToPixel input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + float4 motionVector = float4(CalcNdcMotionVectorFromCsPositions(input.positionCS, input.previousPositionCS), 0, 0); + + return motionVector; + } + + ENDHLSL + } + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt.meta new file mode 100644 index 000000000..36ad4c058 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b3fd67a7feee2e848b1efa22e4d324c0 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader new file mode 100644 index 000000000..62e44e0aa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader @@ -0,0 +1,1435 @@ +BEGIN_OPTIONS + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" + ShaderName "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +END_OPTIONS + +BEGIN_SUBSHADER + +END_SUBSHADER + +BEGIN_PROPERTIES + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 +END_PROPERTIES + + +BEGIN_DEFINES + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON +END_DEFINES + +BEGIN_CBUFFER + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + +END_CBUFFER + +BEGIN_PASS("All") + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] +END_PASS + +BEGIN_CODE + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void ModifyVertex(inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void SurfaceFunction(inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + +END_CODE \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader.meta new file mode 100644 index 000000000..7ce553355 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader.meta @@ -0,0 +1,17 @@ +fileFormatVersion: 2 +guid: 325f1e8448719734a8a423b1dec4f03a +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: ed1b96e11e9064957833ce8c01da6f92, type: 3} +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt new file mode 100644 index 000000000..6f49a8661 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt @@ -0,0 +1,16847 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2019 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector] _StencilRef("Vector1 ", Int) = 0 + [HideInInspector] _StencilWriteMask("Vector1 ", Int) = 3 + [HideInInspector] _StencilRefDepth("Vector1 ", Int) = 0 + [HideInInspector] _StencilWriteMaskDepth("Vector1 ", Int) = 32 + [HideInInspector] _StencilRefMV("Vector1 ", Int) = 128 + [HideInInspector] _StencilWriteMaskMV("Vector1 ", Int) = 128 + [HideInInspector] _StencilRefDistortionVec("Vector1 ", Int) = 64 + [HideInInspector] _StencilWriteMaskDistortionVec("Vector1 ", Int) = 64 + [HideInInspector] _StencilWriteMaskGBuffer("Vector1 ", Int) = 3 + [HideInInspector] _StencilRefGBuffer("Vector1 ", Int) = 2 + [HideInInspector] _ZTestGBuffer("Vector1 ", Int) = 4 + [HideInInspector] [ToggleUI] _RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _ReceivesSSR("Boolean", Float) = 1 + [HideInInspector] _SurfaceType("Vector1 ", Float) = 0 + [HideInInspector] [ToggleUI] _ZWrite("Boolean", Float) = 0 + [HideInInspector] _TransparentSortPriority("Vector1 ", Int) = 0 + [HideInInspector] _ZTestDepthEqualForOpaque("Vector1 ", Int) = 4 + [HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("Vector1", Float) = 4 + [HideInInspector] [ToggleUI] _TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector] _BlendMode("Float", Float) = 0 + } + SubShader + { + Tags { "RenderPipeline"="HDRenderPipeline" "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + Comp Always + Pass Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + // #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADDITIVE _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #define REQUIRE_DEPTH_TEXTURE + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + void Frag(PackedVaryingsToPS packedInput, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + out float4 outDiffuseLighting : SV_Target1, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : SV_Target1 + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = int(_DebugViewMaterialArray[0]); + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = int(_DebugViewMaterialArray[index]); + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + float3 diffuseLighting; + float3 specularLighting; + + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + { + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + // Alias + diffuseLighting = lightLoopOutput.diffuseLighting; + specularLighting = lightLoopOutput.specularLighting; + } + #else + { + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, diffuseLighting, specularLighting); + } + #endif + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + VaryingsPassToPS inputPass = UnpackVaryingsPassToPS(packedInput.vpass); + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(inputPass.positionCS, inputPass.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + ZTest [_ZTestGBuffer] + + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + Comp Always + Pass Replace + } + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + #define SHADERPASS SHADERPASS_GBUFFER + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile _ LIGHT_LAYERS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + void Frag( PackedVaryingsToPS packedInput, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + ZClip [_ZClip] + ZWrite On + ZTest LEqual + + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + float4 Frag(PackedVaryingsToPS packedInput + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) : SV_Target + { + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENESELECTIONPASS + #pragma editor_sync_compilation + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + // #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt.meta new file mode 100644 index 000000000..880246f49 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: e25ae0d994e4df1408dc1cbf96a8adf3 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt new file mode 100644 index 000000000..ede92398d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt @@ -0,0 +1,25666 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2020 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt.meta new file mode 100644 index 000000000..d037fc920 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b8403357ed2de81489de24747f4c4e40 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt new file mode 100644 index 000000000..8b013494b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt @@ -0,0 +1,25521 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2021 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH SHADOW_VERY_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ LIGHT_LAYERS + #pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt.meta new file mode 100644 index 000000000..5939eb9c6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 5545a9e4fbadc354c82bb73fb11b0af7 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt new file mode 100644 index 000000000..2c1581b4d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt @@ -0,0 +1,26350 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2022 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + ColorMask [_LightLayersMaskBuffer4] 4 + ColorMask [_LightLayersMaskBuffer5] 5 + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_LightLayersMaskBuffer4] 4 + ColorMask [_LightLayersMaskBuffer5] 5 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma target 4.5 + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile _ LIGHT_LAYERS + //#pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + AlphaToMask [_AlphaCutoffEnable] + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : DEPTH_OFFSET_SEMANTIC + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = unity_SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt.meta new file mode 100644 index 000000000..8359d6e2e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f92b26827dd1dcc45b0edccd67279b1d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt new file mode 100644 index 000000000..5cf0d42ff --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt @@ -0,0 +1,26401 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: HDRP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma target 4.5 + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ RENDERING_LAYERS + //#pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + AlphaToMask [_AlphaCutoffEnable] + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : DEPTH_OFFSET_SEMANTIC + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = unity_SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLayerMask() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt.meta new file mode 100644 index 000000000..bdafb2502 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a1f8afb0017813b4aac0394c15f9f2a5 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt new file mode 100644 index 000000000..dc97b8bf3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt @@ -0,0 +1,17698 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: Standard +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + } + SubShader + { + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" } + + + + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + // compile directives + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma multi_compile_fwdbase + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + // -------- variant for: + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + #define SHADER_PASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + float4 lmap : TEXCOORD8; + #if UNITY_SHOULD_SAMPLE_SH + half3 sh : TEXCOORD9; // SH + #endif + #ifdef LIGHTMAP_ON + UNITY_LIGHTING_COORDS(10,11) + UNITY_FOG_COORDS(12) + #else + UNITY_FOG_COORDS(10) + UNITY_SHADOW_COORDS(11) + #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + // SH/ambient and vertex lights + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + // Approximated illumination from non-important point lights + #ifdef VERTEXLIGHT_ON + o.sh += 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, o.worldPos, o.worldNormal); + #endif + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif // !LIGHTMAP_ON + + UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader + #else + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + // compute lighting & shadowing factor + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.Specular; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + fixed4 c = 0; + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + giInput.light.color *= mulColor; + #endif + + #if _UNLIT + c.rgb = l.Albedo; + c.a = l.Alpha; + #elif _BDRF3 || _SIMPLELIT + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandardSpecular (o, d.worldSpaceViewDir, gi); + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandard (o, d.worldSpaceViewDir, gi); + #endif + + c.rgb += o.Emission; + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + + + return c; + } + + ENDCG + + } + + + + // ---- deferred shading pass: + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma exclude_renderers nomrt + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_prepassfinal + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifndef DIRLIGHTMAP_OFF + float3 viewDir : TEXCOORD8; + #endif + float4 lmap : TEXCOORD9; + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + half3 sh : TEXCOORD10; // SH + #endif + #else + #ifdef DIRLIGHTMAP_OFF + float4 lmapFadePos : TEXCOORD11; + #endif + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + float3 viewDirForLight = UnityWorldSpaceViewDir(o.worldPos); + #ifndef DIRLIGHTMAP_OFF + float3 worldBinormal = cross(o.worldNormal, o.worldTangent.xyz); + o.viewDir.x = dot(viewDirForLight, o.worldTangent.xyz); + o.viewDir.y = dot(viewDirForLight, worldBinormal); + o.viewDir.z = dot(viewDirForLight, o.worldNormal); + #endif + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #else + o.lmap.zw = 0; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #ifdef DIRLIGHTMAP_OFF + o.lmapFadePos.xyz = (mul(GetObjectToWorldMatrix(), v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + #endif + #else + o.lmap.xy = 0; + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif + + return o; + } + + + + #ifdef LIGHTMAP_ON + float4 unity_LightmapFade; + #endif + fixed4 unity_Ambient; + + + + // fragment shader + void Frag (VertexToPixel IN, + out half4 outGBuffer0 : SV_Target0, + out half4 outGBuffer1 : SV_Target1, + out half4 outGBuffer2 : SV_Target2, + out half4 outEmission : SV_Target3 + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + , out half4 outShadowMask : SV_Target4 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + half atten = 1; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = 0; + gi.light.dir = half3(0,1,0); + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if _BDRF3 || _SIMPLELIT + + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + + outEmission = LightingBlinnPhong_Deferred(o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandardSpecular_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandard_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #endif + + #if defined(_OVERRIDE_SHADOWMASK) && defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + outShadowMask = mulColor; + #endif + + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #else + half4 outShadowMask = 0; + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #endif + + + } + + + + + ENDCG + + } + + + + + // ---- forward rendering additive lights pass: + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardAdd" } + ZWrite Off Blend One One + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma skip_variants INSTANCING_ON + #pragma multi_compile_fwdadd_fullshadows + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + + + #define _PASSFORWARD 1 + #define _PASSFORWARDADD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + UNITY_LIGHTING_COORDS(8,9) + UNITY_FOG_COORDS(10) + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD18; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + half4 c = 0; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + gi.light.color *= atten; + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + #endif + + #if _USESPECULAR + c += LightingStandardSpecular (o, worldViewDir, gi); + #elif _BDRF3 || _SIMPLELIT + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #else + c += LightingStandard (o, worldViewDir, gi); + #endif + + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + #if !_ALPHABLEND_ON + UNITY_OPAQUE_ALPHA(c.a); + #endif + + return c; + } + + ENDCG + + } + + + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + ZWrite On ZTest LEqual + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_shadowcaster + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + V2F_SHADOW_CASTER; // may declare TEXCOORD0 for the wonderfully named .vec + float3 worldPos : TEXCOORD1; + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 texcoord0 : TEXCOORD4; + float4 texcoord1 : TEXCOORD5; + float4 texcoord2 : TEXCOORD6; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD7; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD8; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD16; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + // sets o.pos, so do screenpos after. + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(IN.worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + SHADOW_CASTER_FRAGMENT(IN) + } + + + ENDCG + + } + + + // ---- meta information extraction pass: + Pass + { + Name "Meta" + Tags { "LightMode" = "Meta" } + Cull Off + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "UnityMetaPass.cginc" + + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifdef EDITOR_VISUALIZATION + float2 vizUV : TEXCOORD8; + float4 lightCoord : TEXCOORD9; + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD17; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + + o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #ifdef EDITOR_VISUALIZATION + o.vizUV = 0; + o.lightCoord = 0; + if (unity_VisualizationMode == EDITORVIZ_TEXTURE) + o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST); + else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) + { + o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(GetObjectToWorldMatrix(), float4(v.vertex.xyz, 1))); + } + #endif + + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + + ChainSurfaceFunction(l, d); + + UnityMetaInput metaIN; + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN); + metaIN.Albedo = l.Albedo; + metaIN.Emission = l.Emission; + + #if _USESPECULAR + metaIN.SpecularColor = l.Specular; + #endif + + #ifdef EDITOR_VISUALIZATION + metaIN.VizUV = IN.vizUV; + metaIN.LightCoord = IN.lightCoord; + #endif + return UnityMetaFragment(metaIN); + } + ENDCG + + } + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt.meta new file mode 100644 index 000000000..697144d7e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: d0469e88f445d184f88bc25be7464884 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt new file mode 100644 index 000000000..0bb47d55c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt @@ -0,0 +1,11786 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2019 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "Queue" = "Geometry" } + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + + // Keywords + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF + #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile _ _SHADOWS_SOFT + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + + // GraphKeywords: + + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADER_PASS SHADERPASS_FORWARD + #define SHADERPASS_FORWARD + + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_USESPECULAR) || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + InputData inputData; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + + #if !_UNLIT + #if _SIMPLELIT + half4 color = UniversalFragmentBlinnPhong( + inputData, + l.Albedo, + float4(specular * l.Smoothness, 0), + l.SpecularPower * 128, + l.Emission, + l.Alpha); + color.a = l.Alpha; + #elif _BAKEDLIT + half4 color = color = UniversalFragmentBakedLit(inputData, l.Albedo, l.Alpha, normalTS); + #else + half4 color = UniversalFragmentPBR( + inputData, + l.Albedo, + metallic, + specular, + l.Smoothness, + l.Occlusion, + l.Emission, + l.Alpha); + #endif + + #else + half4 color = half4(l.Albedo, l.Alpha); + #endif + + #if _UNLITFOG && !DISABLEFOG + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_SHADOWCASTER + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_DEPTHONLY + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #define _PASSDEPTH 1 + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + // Render State + Cull Off + // ColorMask: + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + // Name: + Tags + { + "LightMode" = "Universal2D" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define SHADERPASS_2D + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + + half4 color = half4(l.Albedo, l.Alpha); + + return color; + + } + + ENDHLSL + + } + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt.meta new file mode 100644 index 000000000..7f9b523e4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 3a9baa42d2bd0f2418209ef9ad138f0e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt new file mode 100644 index 000000000..3cc2b4fdb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt @@ -0,0 +1,11888 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2020 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF + #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #endif + + #if !_UNLIT + #if _SIMPLELIT + half4 color = UniversalFragmentBlinnPhong( + inputData, + l.Albedo, + float4(specular * l.Smoothness, 0), + l.SpecularPower * 128, + l.Emission, + l.Alpha); + color.a = l.Alpha; + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, l.Albedo, l.Alpha, normalTS); + #else + + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + half4 color = UniversalFragmentPBR(inputData, surface); + + #endif + + #else + half4 color = half4(l.Albedo, l.Alpha); + + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_SHADOWCASTER + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define SHADERPASS_DEPTHONLY + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + // Render State + Cull Off + // ColorMask: + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return float4(PackNormalOctRectEncode(TransformWorldToViewDir(d.worldSpaceNormal, true)), 0.0, 0.0); + + } + + ENDHLSL + + } + + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt.meta new file mode 100644 index 000000000..9dfadefcf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: aa67532b31576e249a3d2c13ec2c0cf8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt new file mode 100644 index 000000000..1539f15b1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt @@ -0,0 +1,14450 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2021 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _CLUSTERED_RENDERING + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "GBuffer" + Tags + { + "LightMode" = "UniversalGBuffer" + } + + Blend One Zero + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile _ SHADOWS_SHADOWMASK + + #define _FOG_FRAGMENT 1 + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADERPASS SHADERPASS_GBUFFER + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + // fragment shader + FragmentOutput Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 0; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + //inputData.fogCoord = IN.fogFactorAndVertexLight.x; + InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.pos, + l.Albedo, + specular, + inputData.normalWS, + metallic, + l.Occlusion, + l.Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData(l.Albedo, metallic, specular, l.Smoothness, l.Alpha, brdfData); + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, l.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + + return BRDFDataToGbuffer(brdfData, inputData, l.Smoothness, l.Emission + color, l.Occlusion); + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = d.worldSpaceNormal; + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on some platforms + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1] + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1] + return half4(packedNormalWS, 0.0); + #else + float3 wsn = l.Normal; + #if !_WORLDSPACENORMAL + wsn = TangentToWorldSpace(d, l.Normal); + #endif + return half4(NormalizeNormalPerPixel(wsn), 0.0); + #endif + + + } + + ENDHLSL + + } + + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt.meta new file mode 100644 index 000000000..03d3d94d0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 69090a1deecc05842bc9e7d8d9f7ae6e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt new file mode 100644 index 000000000..bdd8afaf2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt @@ -0,0 +1,14499 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2022 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "GBuffer" + Tags + { + "LightMode" = "UniversalGBuffer" + } + + Blend One Zero + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + #define _FOG_FRAGMENT 1 + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADERPASS SHADERPASS_GBUFFER + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + // fragment shader + FragmentOutput Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 0; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + //inputData.fogCoord = IN.fogFactorAndVertexLight.x; + InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.pos, + l.Albedo, + specular, + inputData.normalWS, + metallic, + l.Occlusion, + l.Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData(l.Albedo, metallic, specular, l.Smoothness, l.Alpha, brdfData); + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, l.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + + return BRDFDataToGbuffer(brdfData, inputData, l.Smoothness, l.Emission + color, l.Occlusion); + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) && USE_UNITY_CROSSFADE + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outNormalWS : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = d.worldSpaceNormal; + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on some platforms + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1] + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1] + outNormalWS = half4(packedNormalWS, 0.0); + #else + float3 wsn = l.Normal; + #if !_WORLDSPACENORMAL + wsn = TangentToWorldSpace(d, l.Normal); + #endif + outNormalWS = half4(NormalizeNormalPerPixel(wsn), 0.0); + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + + } + + ENDHLSL + + } + + + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt.meta new file mode 100644 index 000000000..5d7c73c32 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 7a76ffb960fb45246965a6e47eeb1a66 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt new file mode 100644 index 000000000..2f09df060 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt @@ -0,0 +1,17678 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2019.4.16f1 +// Render Pipeline: URP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_VERTEX + #pragma multi_compile _ EVALUATE_SH_MIXED + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "GBuffer" + Tags + { + "LightMode" = "UniversalGBuffer" + } + + Blend One Zero + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + #define _FOG_FRAGMENT 1 + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADERPASS SHADERPASS_GBUFFER + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + + // Includes + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + // fragment shader + FragmentOutput Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 0; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + //inputData.fogCoord = IN.fogFactorAndVertexLight.x; + InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.pos, + l.Albedo, + specular, + inputData.normalWS, + metallic, + l.Occlusion, + l.Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData(l.Albedo, metallic, specular, l.Smoothness, l.Alpha, brdfData); + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, l.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + + return BRDFDataToGbuffer(brdfData, inputData, l.Smoothness, l.Emission + color, l.Occlusion); + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + // Includes + //#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) && USE_UNITY_CROSSFADE + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outNormalWS : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = d.worldSpaceNormal; + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on some platforms + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1] + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1] + outNormalWS = half4(packedNormalWS, 0.0); + #else + float3 wsn = l.Normal; + #if !_WORLDSPACENORMAL + wsn = TangentToWorldSpace(d, l.Normal); + #endif + outNormalWS = half4(NormalizeNormalPerPixel(wsn), 0.0); + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + + } + + ENDHLSL + + } + + + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + ColorMask RG + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Plane" } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #define _PASSMOTIONVECTOR 1 + + #pragma target 3.5 + #pragma multi_compile_instancing + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 + + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half4 _MainTex_ST, _MainTex_TexelSize; + half _Alpha, _AlphaCutoffValue; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if FADE_ON + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + + half3 GetPixel(in int offsetX, in int offsetY, in half2 uv, in Texture2D _tex, in SamplerState _sampler) + { + half2 _uv = uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y); + half4 col = SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + return col.rgb; + } + + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + + half rand2CustomTime(half2 seed, half offset, half customTime) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12.), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = half4(localPos, 1); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = TRANSFORM_TEX(v.texcoord0.xy, _MainTex); + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex); + #endif + + #if DISTORT_ON + v.texcoord3.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ST.x, d.texcoord0.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + float normalSign = sign(dot(d.worldSpaceViewDir, d.worldSpaceNormal)); + o.Normal *= normalSign; + + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, sampler_MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex) - GetPixel(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, sampler_MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord3.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord3 = half2((d.texcoord3.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord3.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord3).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = TRANSFORM_TEX(d.texcoord0, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(d.texcoord0, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + o.Albedo = col; + col.a *= _Alpha; + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = _Color.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // Using parts of com.unity.render-pipelines.universal\Editor\ShaderGraph\Includes\MotionVectorPass.hlsl + // com.unity.render-pipelines.universal\ShaderLibrary\MotionVectorsCommon.hlsl + // com.unity.render-pipelines.universal\Editor\ShaderGraph\Includes\Varyings.hlsl + + float2 CalcNdcMotionVectorFromCsPositions(float4 posCS, float4 prevPosCS) + { + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + return float2(0.0, 0.0); + + // Non-uniform raster needs to keep the posNDC values in float to avoid additional conversions + // since uv remap functions use floats + float2 posNDC = posCS.xy * rcp(posCS.w); + float2 prevPosNDC = prevPosCS.xy * rcp(prevPosCS.w); + + float2 velocity; + #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) + UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) + { + // Convert velocity from NDC space (-1..1) to screen UV 0..1 space since FoveatedRendering remap needs that range. + float2 posUV = RemapFoveatedRenderingResolve(posNDC * 0.5 + 0.5); + float2 prevPosUV = RemapFoveatedRenderingPrevFrameLinearToNonUniform(prevPosNDC * 0.5 + 0.5); + + // Calculate forward velocity + velocity = (posUV - prevPosUV); + #if UNITY_UV_STARTS_AT_TOP + velocity.y = -velocity.y; + #endif + } + else + #endif + { + // Calculate forward velocity + velocity = (posNDC.xy - prevPosNDC.xy); + #if UNITY_UV_STARTS_AT_TOP + velocity.y = -velocity.y; + #endif + + // Convert velocity from NDC space (-1..1) to UV 0..1 space + // Note: It doesn't mean we don't have negative values, we store negative or positive offset in UV space. + // Note: ((posNDC * 0.5 + 0.5) - (prevPosNDC * 0.5 + 0.5)) = (velocity * 0.5) + velocity.xy *= 0.5; + } + + return velocity; + } + + float4 Frag( + VertexToPixel input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + float4 motionVector = float4(CalcNdcMotionVectorFromCsPositions(input.positionCS, input.previousPositionCS), 0, 0); + + return motionVector; + } + + ENDHLSL + } + + + + + + } + + + CustomEditor "AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt.meta new file mode 100644 index 000000000..74f02cfd3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a84fbc897c8eaaf40b7075fd17cdbb7f +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt new file mode 100644 index 000000000..612a832a7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt @@ -0,0 +1,31 @@ +# BetterShaders_AllIn1Sprite Shader + +This shader was created using Better Shaders, a Unity asset by Jason Booth that simplifies cross-pipeline shader development. + +## Usage +- If you own Better Shaders: You can modify the shader's source code: AllIn1SpriteShaderLit_BetterShader.surfshader +- If you don't own Better Shaders: A pre-compiled version matching your current Render Pipeline and Unity version will be automatically set up. + +## Why Better Shaders? +Better Shaders was used because Unity doesn't have an easy way to create hand written lit shaders compatible across all render pipelines. + +## About Better Shaders +Better Shaders streamlines shader creation by: +- Enabling Unity-like shader writing +- Auto-compiling for various pipelines +- Allowing shader stacking +- Functioning like native Unity shaders + +For more information or to purchase Better Shaders, visit: +[Better Shaders on Unity Asset Store](https://assetstore.unity.com/packages/tools/visual-scripting/better-shaders-2022-standard-urp-hdrp-244057) + +## What are all the .txt shaders and how to export them? +The .txt shaders are the pipeline-specific source code for the shader. You can export them by: +1. Selecting AllIn1SpriteShaderLit_BetterShader.surfshader +2. Export all shaders as text assets + +Doing this will cause some URP and HDRP shaders material inspectors properties to be in the incorrect order. To fix this, you can: +1. Localize the Better Shaders2022 folder +2. Inside you'll see the PipelineTemplates folder +3. There, find your pipeline's template +4. Make sure that "%PROPERTIES%" is right under "Properties{" diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt.meta new file mode 100644 index 000000000..f881b9879 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 4026e642526007b45b74a1f1064e6ba2 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/_README.txt + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures.meta b/Assets/Plugins/AllIn1SpriteShader/Textures.meta new file mode 100644 index 000000000..3b81dbc5b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c6641ac06ac9d643898c55a675118f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures.meta new file mode 100644 index 000000000..1cadac333 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5dc994715c67a694eafe9d1fba38560d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png new file mode 100644 index 000000000..5eb2819c5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b5685c35723ee7be60b4762988dc062b586509f23baa8a9abc800b563dbc35b +size 203 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png.meta new file mode 100644 index 000000000..d3eed65a7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 7062336ff4b66994caa2ba23c8651342 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 6534a81033212394099b1c2e60060263 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png new file mode 100644 index 000000000..95111f845 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acf9d0c4217fc45669a4639468132e73c8766b8727790b4f32198a4de0706546 +size 212 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png.meta new file mode 100644 index 000000000..0f9cf5d3a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 2eb26501acf862843a55a2e79af0c3c8 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: b49496914e94fc94f80d6b9197ecf935 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd new file mode 100644 index 000000000..3d885075a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0d0a3569f3b4f0e259e1a885fe81a443591ff81ab8d8f2ced4dabe3f2b25cd4 +size 21680 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd.meta new file mode 100644 index 000000000..cb4d8d0af --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: a9058d3dd9b9dd14cbc6b16db7859653 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 6b5fce476d6279846b6aee1cf9447c38 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd new file mode 100644 index 000000000..c4bcccf6a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6977542931311fc22bf56aaed4013a10153fd3e5d2dc901cf738ec1c4358a35 +size 20778 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd.meta new file mode 100644 index 000000000..4507c8d2f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: bf981ecbfe649344eafdbc788f6dab0f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: c61c2ea72b408804c90e310880261312 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png new file mode 100644 index 000000000..7f570d79e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:162a443b6bd69188f4dea910f10ef5a66281a2b5d16141c336611778678da682 +size 2805 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png.meta new file mode 100644 index 000000000..66ad1435a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 279657edc397ece4b8029c727adf6ddc +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 85966af9cdddb7d4bbd347c94e844740 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd new file mode 100644 index 000000000..e4b8eb2d7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f140a9fa15fb6c73e7057a034b220bffd9a7eae9c6fba620279c4a911152b87 +size 21226 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd.meta new file mode 100644 index 000000000..3b99ec0d1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: b3cfc9bf16a1cfa4ab153965dff63ad3 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: f38908602dd238b409bc43bb9953646d + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png new file mode 100644 index 000000000..64e66063a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:caaa8ddd5251adfb02f99db982c122004c4d7da412f727cff246eb61401a729a +size 131 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png.meta new file mode 100644 index 000000000..c0b46a825 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 763e13699209a614b8800c76fc9dee48 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 4acacabd6b7da7644a38538f7ac969fa + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd new file mode 100644 index 000000000..176726c3b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd5452ac1f7bf526f95099bbbe082fc99c30c1bede0d372311371331d01b09db +size 21682 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd.meta new file mode 100644 index 000000000..d3472103f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 285a35f6ccf7b1a44b6c198e96105173 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 45d692c8481a23a4ca4bf338eb345b89 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png new file mode 100644 index 000000000..6759192a6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88407a72b33e132dfa87ec0d49c804ce61a24e24b38ddd65dcb93a59db19a1b1 +size 112 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png.meta new file mode 100644 index 000000000..25464c333 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 54b37de4aa07caa4797254cf2351058f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: fdaff416f4292e748acd0edc2ccd3a1b + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png new file mode 100644 index 000000000..9c4aa1201 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32cd4ccbb2e3855767105194e46b75cad8e62e73a9e5c6ce3cee75f6d8802058 +size 112 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png.meta new file mode 100644 index 000000000..1c64405c0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 359431ef2af87794198688f7c632c1e3 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: c8412b3bf254b83478e63d50248d9511 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd new file mode 100644 index 000000000..9fe7457aa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:123b94a07bced3c211c8d8a47f3f0052de42c2eacf871efd68b06ea6e28b16ef +size 21678 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd.meta new file mode 100644 index 000000000..e98a74ba9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: cbb1819678c0e5a4c82464e4b1c0ce1c +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: bbc95717f5bfe2342801eb1509f0c21e + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png new file mode 100644 index 000000000..e68fb94c9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76df32b777fa3ad992c575a0818b7f0fa8e28d7cd1a5320504ca28911a4aba25 +size 112 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png.meta new file mode 100644 index 000000000..2c751757e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 8700b580d2f74da46b4cbcb5fde72d63 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 8bac87bbb6aabc449b1dbd4f1da1819f + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png new file mode 100644 index 000000000..51e0a85a9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e96ce31ad113e70e8dc80636f0529cfb017898db41aeef58bc93d64fb841ce4 +size 112 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png.meta new file mode 100644 index 000000000..352be0208 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 2a39734b8956da843adee1646c75554f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 9deeee28a79225f4fb4d99a97a42b3ea + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png new file mode 100644 index 000000000..df3157ec0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:742c92953e8b02fb657ed105ca52c98fe2150f407b5002d04af9ad816d878306 +size 112 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png.meta new file mode 100644 index 000000000..c47cef5cd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 6fc6eee88963e63429ed61892dadd042 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 5a250b7cef21ca84d8fc79970b91cc65 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png new file mode 100644 index 000000000..b69c11212 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:068d6725cdb319cbac6483f9f9115fbfd4c718af68c31191bee13eaddec06ab7 +size 1982 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png.meta new file mode 100644 index 000000000..b349947b0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 555ec36b8c5401649af750d9738c7ddf +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 592402d35dab4094da345853c417524b + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png new file mode 100644 index 000000000..9f585bd80 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25fefd4f379c0b0fc686e711f19666bb3ac9250c29de22741e1138b6e13922f0 +size 1848 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png.meta new file mode 100644 index 000000000..0c42d5469 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 536abb94c423a3443b5151f665cdc017 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: f37da52049ecfd04eb6a0a5176418ac1 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps.meta new file mode 100644 index 000000000..8a0572227 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c509d09ace1b4f84da7401dc3c5616a3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png new file mode 100644 index 000000000..9dfaf78ad --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c2b2ef2140965e648be14e73e25fdd0667db75b459bc1df0c08cdfb185670d6 +size 63306 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png.meta new file mode 100644 index 000000000..88bc767d9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 115ee11beb34a5247bc5bd53377a08f2 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 04a63e1d3a18ab9419ae1e2e245ef80a + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png b/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png new file mode 100644 index 000000000..52989cd23 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80b2f2e8708b8526e785cfd6211a739bf985e59e78d560363c1b2305191d2b1f +size 4024 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png.meta new file mode 100644 index 000000000..82ab86b54 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: a4a73598226c9dd48aedc26a44264bdf +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 32 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + 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 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + 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: 49b78288c6606b142947c3702972ad14 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/black.png b/Assets/Plugins/AllIn1SpriteShader/Textures/black.png new file mode 100644 index 000000000..df6dddeb0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/black.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0f86f41eb95646ca36ac544093fa6daf3563b2dc272ce603cc1b0d49544f455 +size 1779 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/black.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/black.png.meta new file mode 100644 index 000000000..70de915d4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/black.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 0b8da974a6429b8489e21c2a5d8dd509 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: f397292dae7cff94fa11946d513d2c05 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/black.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png b/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png new file mode 100644 index 000000000..9041cda6a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e14c672e8929669124c1ff04e301049d163e38ff4d86979f5777a39aceedd94 +size 344085 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png.meta new file mode 100644 index 000000000..f89f84c38 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 253ade5030af1b643bf9a54cceb26f01 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 87af0f70de267414287ea2f131be64a9 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/fire.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png b/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png new file mode 100644 index 000000000..e436bec32 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e0a8a2900058341c33a3d4001700bcff1a70e5ac7c5f884982b61c8542f6242 +size 499363 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png.meta new file mode 100644 index 000000000..cf0104762 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 677cca399782dea41aedc1d292ecb67d +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 164c93aa3c349884aab20273f4e027ed + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png new file mode 100644 index 000000000..175dc1780 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9e678665bd9dac8c72aa1166f88256bc31fc7d6b518fdedb320cb0464afe4d5 +size 41997 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png.meta new file mode 100644 index 000000000..c288b54a6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 806e236bc12668e4da974bb8f536d28f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 00ad019334681ad4e94f90f4e6870ade + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png new file mode 100644 index 000000000..3703860a5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc167dff72346211e862097164ca578d7f217ffdf215ab6552e64bead2ed0e2f +size 27774 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png.meta new file mode 100644 index 000000000..e4cf8a100 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: e3763a0fd85c67f4f9f31b55f886d31d +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: df4dc4f6bf59b0046b0f0b70b9c13a19 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png new file mode 100644 index 000000000..abae35750 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07482f5b4d1e6d369eef34283daf566ef36d967492a49780cff1a83903a5ac57 +size 8611 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png.meta new file mode 100644 index 000000000..d828fb812 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: b2ae57e82cd4b4d4ebfa9986f7c77c83 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: e7046a03f726c4e48b86b2beaa92795d + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png new file mode 100644 index 000000000..7dc47e7b6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38d5bbbe24ab41cc417ace8fedcf1cb3e51835a32293520b98b08346c12f0874 +size 14419 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png.meta new file mode 100644 index 000000000..1df2ab2ff --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: dbaa905cec0d2b944b5d1ebdbc3ceb1e +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: fe5dc1f04fb78b54aab6a687e244d6d7 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png b/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png new file mode 100644 index 000000000..7c43e7bc3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc8eeb8b4bfa5ffabbfccd9014f60dbbdcb4d5da3e6944a17379aa34d989e81e +size 18857 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png.meta new file mode 100644 index 000000000..b1430312f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 74087f6d03f233e4a8a142fa01f9e5cf +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: adace43c9876fa64fb0fa83de503839c + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png b/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png new file mode 100644 index 000000000..e3db93f9e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a2555485e71a67e83e4d945f3fde875e5605b8654ed9983c5588429dfb56eeb +size 52101 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png.meta new file mode 100644 index 000000000..bfa9228aa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 7aad8c583ef292e48b06af0d1f2fab97 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 50 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 59e65a015812bfd44aabe97ca2ef2ca1 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png b/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png new file mode 100644 index 000000000..2cf1bcb1c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1e8785cfeb7518ca1ced7d24cc2a07fea178c88a7e1876027cc83366b45e4df +size 68640 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png.meta new file mode 100644 index 000000000..94d2ae0cd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: f96aebb9bcd1e3b44bafbb23b1bdac88 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: c347a607987f5654397113952ea0e2bd + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png + uploadId: 771745 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/white.png b/Assets/Plugins/AllIn1SpriteShader/Textures/white.png new file mode 100644 index 000000000..c18af4593 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/white.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:771d840221ca6f1183225b1f3efed0209b2ac5ae3487350b8404e49f14c5d8d0 +size 1367 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/white.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/white.png.meta new file mode 100644 index 000000000..a93cb00c4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/white.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 839adabbc5de26041bac66450214a831 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 8 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 407e6d8edc94c6b4a9325118700cfe09 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.32 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/white.png + uploadId: 771745 diff --git a/Assets/_DDD/Common/Materials/ItemSlotUi.mat b/Assets/_DDD/Common/Materials/ItemSlotUi.mat index 273fcad67..f20f61df3 100644 --- a/Assets/_DDD/Common/Materials/ItemSlotUi.mat +++ b/Assets/_DDD/Common/Materials/ItemSlotUi.mat @@ -21,7 +21,7 @@ Material: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: ItemSlotUi - m_Shader: {fileID: 4800000, guid: e320962886da01749b5c68627fde4db9, type: 3} + m_Shader: {fileID: 4800000, guid: a53f4bb29f3644b43b5075c6dcfecb32, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 m_ValidKeywords: